Skip to content

Commit 37532fb

Browse files
author
David Wootton
committed
Fix memory leak in mca_base_alias_register
Coverity CID 1462700 Signed-off-by: David Wootton <dwootton@us.ibm.com>
1 parent 4e4c43e commit 37532fb

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

opal/mca/base/mca_base_alias.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,7 @@ int mca_base_alias_register(const char *project, const char *framework, const ch
149149
if (NULL == alias) {
150150
alias = OBJ_NEW(mca_base_alias_t);
151151
if (NULL == alias) {
152-
if (NULL != name) {
153-
free(name);
154-
}
152+
free(name);
155153
return OPAL_ERR_OUT_OF_RESOURCE;
156154
}
157155

@@ -162,9 +160,7 @@ int mca_base_alias_register(const char *project, const char *framework, const ch
162160

163161
mca_base_alias_item_t *alias_item = OBJ_NEW(mca_base_alias_item_t);
164162
if (NULL == alias_item) {
165-
if (NULL != name) {
166-
free(name);
167-
}
163+
free(name);
168164
return OPAL_ERR_OUT_OF_RESOURCE;
169165
}
170166

@@ -173,6 +169,7 @@ int mca_base_alias_register(const char *project, const char *framework, const ch
173169

174170
opal_list_append(&alias->component_aliases, &alias_item->super);
175171

172+
free(name);
176173
return OPAL_SUCCESS;
177174
}
178175

0 commit comments

Comments
 (0)