提交 0a618df0 编写于 作者: M Matt Caswell

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: NRichard Levitte <levitte@openssl.org>
上级 308ff286
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册