[openssl-commits] [openssl] master update
Matt Caswell
matt at openssl.org
Mon May 23 23:14:05 UTC 2016
The branch master has been updated
via 0a618df059d93bf7fe9e3ec92e04db8bc1eeff07 (commit)
from 308ff28673ae1a4a1b346761224b4a8851d41f58 (commit)
- Log -----------------------------------------------------------------
commit 0a618df059d93bf7fe9e3ec92e04db8bc1eeff07
Author: Matt Caswell <matt at openssl.org>
Date: Mon May 9 17:44:26 2016 +0100
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 at openssl.org>
-----------------------------------------------------------------------
Summary of changes:
crypto/objects/o_names.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/crypto/objects/o_names.c b/crypto/objects/o_names.c
index e43fb30..c655a90 100644
--- a/crypto/objects/o_names.c
+++ b/crypto/objects/o_names.c
@@ -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)
More information about the openssl-commits
mailing list