fix string leak with blob write_text
This commit is contained in:
@@ -199,9 +199,12 @@ static JSValue js_blob_write_text(JSContext *ctx, JSValueConst this_val,
|
||||
// Handle number or single character string
|
||||
const char *str = JS_ToCString(ctx, argv[0]);
|
||||
|
||||
if (blob_write_text(bd, str) < 0)
|
||||
if (blob_write_text(bd, str) < 0) {
|
||||
JS_FreeCString(ctx,str);
|
||||
return JS_ThrowTypeError(ctx, "write_kim: cannot write to stone blob or OOM");
|
||||
}
|
||||
|
||||
JS_FreeCString(ctx,str);
|
||||
return JS_UNDEFINED;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user