diff --git a/CHANGELOG.md b/CHANGELOG.md index 498da6fde..11774f7d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ SPDX-License-Identifier: GPL-3.0-or-later - irc: fix unit of server option `anti_flood` from seconds to milliseconds in output of `/server listfull` - irc: fix creation of irc.msgbuffer option without a server name - irc: ignore self join if the channel is already joined ([#2291](https://github.com/weechat/weechat/issues/2291)) +- relay/api: fix memory leaks in resources "ping" and "sync" ## Version 4.8.1 (2025-12-01) diff --git a/src/plugins/relay/api/relay-api-protocol.c b/src/plugins/relay/api/relay-api-protocol.c index fbc8da059..589b86b26 100644 --- a/src/plugins/relay/api/relay-api-protocol.c +++ b/src/plugins/relay/api/relay-api-protocol.c @@ -1056,13 +1056,15 @@ RELAY_API_PROTOCOL_CALLBACK(ping) cJSON_CreateString ((ptr_data) ? ptr_data : "")); relay_api_msg_send_json (client, RELAY_HTTP_200_OK, NULL, "ping", json); cJSON_Delete (json); - cJSON_Delete (json_body); } else { relay_api_msg_send_json (client, RELAY_HTTP_204_NO_CONTENT, NULL, NULL, NULL); } + if (json_body) + cJSON_Delete (json_body); + return RELAY_API_PROTOCOL_RC_OK; } @@ -1121,6 +1123,9 @@ RELAY_API_PROTOCOL_CALLBACK(sync) relay_api_msg_send_json (client, RELAY_HTTP_204_NO_CONTENT, NULL, NULL, NULL); + if (json_body) + cJSON_Delete (json_body); + return RELAY_API_PROTOCOL_RC_OK; }