Skip to content
Permalink
Browse files

Memory Leak due to JSStringRelease not called in multiple places in J…

…SCRuntime.cpp (#25884)

Summary:
Memory Leak due to JSStringRelease not called in multiple places in JSCRuntime.cpp
Issue: #25664
Reproducible repo: https://github.com/bhandarijiwan/memory_issue_repro

## Changelog
[JSC] [JSCRuntime.cpp] - Added missing JSStringRelease calls in missing places
Pull Request resolved: #25884

Test Plan: Tested that is no memory leak with various NativeModule to JS call flows

Reviewed By: JoshuaGross

Differential Revision: D16928985

Pulled By: TheSavior

fbshipit-source-id: 65ce15ae32482d0db39bad7e22a2fed9ee04f230
  • Loading branch information...
sachinservicemax authored and grabbou committed Aug 21, 2019
1 parent c57bfea commit ba5222f3ccd6de3f49acd6b8649686849d910e60
Showing with 3 additions and 1 deletion.
  1. +3 −1 ReactCommon/jsi/JSCRuntime.cpp
@@ -630,7 +630,9 @@ jsi::String JSCRuntime::createStringFromUtf8(
size_t length) {
std::string tmp(reinterpret_cast<const char*>(str), length);
JSStringRef stringRef = JSStringCreateWithUTF8CString(tmp.c_str());
return createString(stringRef);
auto result = createString(stringRef);
JSStringRelease(stringRef);
return result;
}

std::string JSCRuntime::utf8(const jsi::String& str) {

0 comments on commit ba5222f

Please sign in to comment.
You can’t perform that action at this time.