From 7ff6517b943aff0fc5c7a667335a1cd3903c6951 Mon Sep 17 00:00:00 2001 From: Marcio Barbosa Date: Wed, 27 Mar 2024 12:40:03 +0000 Subject: [PATCH] bozo: Fix memory leak in ez_create() Currently, ez_create() fails to release cmdpath when it returns early due to a failure returned by bnode_InitBnode(). This commit resolves this issue by ensuring that cmdpath is properly deallocated in such failure scenarios, thereby preventing memory leaks. Change-Id: I03b137f9f45eca41c538574d842e99445bf55b2c Reviewed-on: https://gerrit.openafs.org/15718 Tested-by: BuildBot Reviewed-by: Cheyenne Wills Reviewed-by: Michael Meffie --- src/bozo/ezbnodeops.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bozo/ezbnodeops.c b/src/bozo/ezbnodeops.c index 57d10a8644..6046b450a5 100644 --- a/src/bozo/ezbnodeops.c +++ b/src/bozo/ezbnodeops.c @@ -117,6 +117,7 @@ ez_create(char *ainstance, char *acommand, char *unused1, char *unused2, te = calloc(1, sizeof(struct ezbnode)); if (bnode_InitBnode((struct bnode *)te, &ezbnode_ops, ainstance) != 0) { free(te); + free(cmdpath); return NULL; } te->command = cmdpath;