From 7713a2470d5843687b1bdaa8cf3ab8922b302cc1 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 6 Apr 2021 19:16:23 +0300 Subject: [PATCH] [libdingaling] Fix memory leaks --- libs/libdingaling/src/libdingaling.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/libdingaling/src/libdingaling.c b/libs/libdingaling/src/libdingaling.c index 6fbedfda6e..ee08f041c0 100644 --- a/libs/libdingaling/src/libdingaling.c +++ b/libs/libdingaling/src/libdingaling.c @@ -1297,6 +1297,8 @@ static int on_subscribe(void *user_data, ikspak *pak) handle->session_callback(handle, NULL, LDL_SIGNAL_SUBSCRIBE, to, from, NULL, NULL); } + if (id) free(id); + return IKS_FILTER_EAT; } @@ -2325,6 +2327,9 @@ void ldl_handle_send_msg(ldl_handle_t *handle, char *from, char *to, const char if (strchr(my_body, '<')) { len = (int) strlen(my_body); if (!(bdup = malloc(len))) { + if (my_body_base) { + free(my_body_base); + } return; }