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 <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
This commit is contained in:
Marcio Barbosa 2024-03-27 12:40:03 +00:00 committed by Michael Meffie
parent 159bd949a4
commit 7ff6517b94

View File

@ -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;