]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_xml_rpc] Coverity CID 1294469 (Resource leak) 2032/head
authorJakub Karolczyk <jakub.karolczyk@signalwire.com>
Thu, 6 Apr 2023 00:11:35 +0000 (01:11 +0100)
committerJakub Karolczyk <jakub.karolczyk@signalwire.com>
Thu, 6 Apr 2023 21:31:50 +0000 (22:31 +0100)
src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c

index 43e25b6f9ef844f1f68ad4854aa3d2fb2b10bdb0..8e49462d2c20e31b404a6eca8f502f0f02e21329 100644 (file)
@@ -614,7 +614,7 @@ abyss_bool websocket_hook(TSession *r)
 
        if (ret != 0) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "handshake error %d\n", ret);
-               return FALSE;
+               goto err;
        }
 
        if (switch_event_bind_removable("websocket", SWITCH_EVENT_CUSTOM, "websocket::stophook", stop_hook_event_handler, wsh, &nodes[node_count++]) != SWITCH_STATUS_SUCCESS) {
@@ -696,8 +696,11 @@ abyss_bool websocket_hook(TSession *r)
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "wsh->down = %d, node_count = %d\n", wsh->down, node_count);
 
        switch_yield(2000);
+
        while (--node_count >= 0) switch_event_unbind(&nodes[node_count]);
 
+  err:
+       ws_destroy(wsh);
        switch_safe_free(wsh);
 
        return FALSE;