From 2bf9b2bf8db6c5ddf8e0b334f18f3b2088ff2ea3 Mon Sep 17 00:00:00 2001 From: avsdev-cw Date: Fri, 9 Oct 2020 13:30:16 +0100 Subject: [PATCH] Fixed memory leak --- src/modb_metadata.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/modb_metadata.c b/src/modb_metadata.c index 64f85c5..3586e81 100644 --- a/src/modb_metadata.c +++ b/src/modb_metadata.c @@ -271,11 +271,6 @@ int modbMetadataListByGroupId(stored_conn *sconn, modb_ref *modb, unsigned int g return 0; } - *metadata_list = (struct metadata_t **)malloc(sizeof(struct metadata_t *) * n_ids); - if (*metadata_list == 0) { - return -1; - } - wb = whereIn(0, 0, "mdo_id", TYPE_ID, 0); for (idx = 0; idx < n_ids; idx++) { setWhereValue(wb, TYPE_ID, 1, *(ids + idx)); @@ -285,6 +280,7 @@ int modbMetadataListByGroupId(stored_conn *sconn, modb_ref *modb, unsigned int g freeWhereBuilder(&wb); } + free(ids); return res; }