mirror of
https://github.com/openssl/openssl.git
synced 2025-01-18 13:44:20 +08:00
Fix a mem leak on an error path in OBJ_NAME_add()
If lh_OBJ_NAME_insert() fails then the allocated |onp| value is leaked. RT#2238 Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
parent
308ff28673
commit
0a618df059
@ -191,7 +191,7 @@ int OBJ_NAME_add(const char *name, int type, const char *data)
|
||||
onp = OPENSSL_malloc(sizeof(*onp));
|
||||
if (onp == NULL) {
|
||||
/* ERROR */
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
onp->name = name;
|
||||
@ -216,10 +216,11 @@ int OBJ_NAME_add(const char *name, int type, const char *data)
|
||||
} else {
|
||||
if (lh_OBJ_NAME_error(names_lh)) {
|
||||
/* ERROR */
|
||||
return (0);
|
||||
OPENSSL_free(onp);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int OBJ_NAME_remove(const char *name, int type)
|
||||
|
Loading…
Reference in New Issue
Block a user