Skip to content
Snippets Groups Projects
Commit 4e9ff218 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Fix apparent memory leak in js_listening_socket_constructor()

The socket set allocated by xpms_create() was never freed. Found by Coverity.
parent a6efc1be
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #1342 passed
...@@ -396,8 +396,9 @@ static void js_finalize_socket(JSContext *cx, JSObject *obj) ...@@ -396,8 +396,9 @@ static void js_finalize_socket(JSContext *cx, JSObject *obj)
do_js_close(p, true); do_js_close(p, true);
if(p->hostname) if(!p->external)
free(p->hostname); free(p->set);
free(p->hostname);
free(p); free(p);
JS_SetPrivate(cx, obj, NULL); JS_SetPrivate(cx, obj, NULL);
...@@ -2817,7 +2818,6 @@ js_listening_socket_constructor(JSContext *cx, uintN argc, jsval *arglist) ...@@ -2817,7 +2818,6 @@ js_listening_socket_constructor(JSContext *cx, uintN argc, jsval *arglist)
JS_ReportError(cx, "Unable to create socket set"); JS_ReportError(cx, "Unable to create socket set");
goto fail; goto fail;
} }
// A for Digitman: "Nothing." -- DigitalMan (via Mumble)
if (obj == NULL) { if (obj == NULL) {
JSVALUE_TO_MSTRING(cx, argv[0], interface, NULL); JSVALUE_TO_MSTRING(cx, argv[0], interface, NULL);
HANDLE_PENDING(cx, interface); HANDLE_PENDING(cx, interface);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment