[Accel-config] [PATCH v1 3/6] accel-config: Free some allocated memory that were not being freed

ramesh.thomas at intel.com
Newsgroups dev.linux.lists.accel-config
Message-ID <[email protected]>
From: Ramesh Thomas <ramesh.thomas(a)intel.com>

accfg_get_param_str() allocates memory and returns a pointer. The
returned memory was not getting freed.

Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
 accfg/lib/libaccfg.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/accfg/lib/libaccfg.c b/accfg/lib/libaccfg.c
index 57e6d1f..548827e 100644
--- a/accfg/lib/libaccfg.c
+++ b/accfg/lib/libaccfg.c
@@ -205,6 +205,9 @@ static void free_wq(struct accfg_wq *wq)
 	list_del_from(&device->wqs, &wq->list);
 	free(wq->wq_path);
 	free(wq->wq_buf);
+	free(wq->mode);
+	free(wq->state);
+	free(wq->name);
 	free(wq);
 }
 
@@ -215,6 +218,8 @@ static void free_group(struct accfg_group *group)
 	list_del_from(&device->groups, &group->list);
 	free(group->group_buf);
 	free(group->group_path);
+	free(group->group_engines);
+	free(group->group_wqs);
 	free(group);
 }
 
@@ -754,6 +759,9 @@ static void *add_wq(void *parent, int id, const char *wq_base,
 err_read:
 	free(wq->wq_buf);
 	free(wq->wq_path);
+	free(wq->mode);
+	free(wq->state);
+	free(wq->name);
 err_wq:
 	free(wq);
 	free(path);
@@ -842,8 +850,10 @@ static void *add_group(void *parent, int id, const char *group_base,
 
 err_read:
 	free(group->group_buf);
-	free(group);
+	free(group->group_engines);
+	free(group->group_wqs);
 err_group:
+	free(group);
 	free(path);
 	return NULL;
 }
-- 
2.26.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.