Commit 3052263f by Stefan Penner

[LEAK FIX] create_string must be paired with a free

parent 4cf43ac9
...@@ -158,7 +158,9 @@ int ExtractOptions(v8::Local<v8::Object> options, void* cptr, sass_context_wrapp ...@@ -158,7 +158,9 @@ int ExtractOptions(v8::Local<v8::Object> options, void* cptr, sass_context_wrapp
CustomFunctionBridge *bridge = new CustomFunctionBridge(callback, ctx_w->is_sync); CustomFunctionBridge *bridge = new CustomFunctionBridge(callback, ctx_w->is_sync);
ctx_w->function_bridges.push_back(bridge); ctx_w->function_bridges.push_back(bridge);
Sass_Function_Entry fn = sass_make_function(create_string(signature), sass_custom_function, bridge); char* sig = create_string(signature);
Sass_Function_Entry fn = sass_make_function(sig, sass_custom_function, bridge);
free(sig);
sass_function_set_list_entry(fn_list, i, fn); sass_function_set_list_entry(fn_list, i, fn);
} }
...@@ -290,6 +292,7 @@ NAN_METHOD(render_sync) { ...@@ -290,6 +292,7 @@ NAN_METHOD(render_sync) {
} }
sass_free_context_wrapper(ctx_w); sass_free_context_wrapper(ctx_w);
info.GetReturnValue().Set(result == 0); info.GetReturnValue().Set(result == 0);
} }
......
...@@ -29,6 +29,7 @@ SassImportList CustomImporterBridge::post_process_return_value(v8::Local<v8::Val ...@@ -29,6 +29,7 @@ SassImportList CustomImporterBridge::post_process_return_value(v8::Local<v8::Val
imports[i] = sass_make_import_entry(0, 0, 0); imports[i] = sass_make_import_entry(0, 0, 0);
sass_import_set_error(imports[i], message, -1, -1); sass_import_set_error(imports[i], message, -1, -1);
free(message);
} }
else { else {
imports[i] = get_importer_entry(object); imports[i] = get_importer_entry(object);
...@@ -43,6 +44,7 @@ SassImportList CustomImporterBridge::post_process_return_value(v8::Local<v8::Val ...@@ -43,6 +44,7 @@ SassImportList CustomImporterBridge::post_process_return_value(v8::Local<v8::Val
imports[0] = sass_make_import_entry(0, 0, 0); imports[0] = sass_make_import_entry(0, 0, 0);
sass_import_set_error(imports[0], message, -1, -1); sass_import_set_error(imports[0], message, -1, -1);
free(message);
} }
else if (returned_value->IsObject()) { else if (returned_value->IsObject()) {
imports = sass_make_import_list(1); imports = sass_make_import_list(1);
......
...@@ -23,6 +23,10 @@ namespace SassTypes ...@@ -23,6 +23,10 @@ namespace SassTypes
} }
unit = create_string(raw_val[1]); unit = create_string(raw_val[1]);
*out = sass_make_number(value, unit);
delete unit;
return *out;
} }
} }
......
...@@ -15,11 +15,16 @@ namespace SassTypes ...@@ -15,11 +15,16 @@ namespace SassTypes
} }
value = create_string(raw_val[0]); value = create_string(raw_val[0]);
} *out = sass_make_string(value);
delete value;
return *out;
} else {
return *out = sass_make_string(value); return *out = sass_make_string(value);
} }
}
void String::initPrototype(v8::Local<v8::FunctionTemplate> proto) { void String::initPrototype(v8::Local<v8::FunctionTemplate> proto) {
Nan::SetPrototypeMethod(proto, "getValue", GetValue); Nan::SetPrototypeMethod(proto, "getValue", GetValue);
Nan::SetPrototypeMethod(proto, "setValue", SetValue); Nan::SetPrototypeMethod(proto, "setValue", SetValue);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment