提交 d918f851 编写于 作者: G Geoff Thorpe

Fix a memory leak in 'sk_dup' in the case a realloc() fails. Also, tidy up

a bit of weird code in sk_new.
上级 a95541d6
......@@ -11,6 +11,10 @@
*) applies to 0.9.6a (/0.9.6b) and 0.9.7
+) applies to 0.9.7 only
+) Fix a memory leak in 'sk_dup()' in the case reallocation fails. (Also
tidy up some unecessarily weird code in 'sk_new()').
[Geoff, reported by Diego Tartara <dtartara@novamens.com>]
+) Change the key loading routines for ENGINEs to use the same kind
callback (pem_password_cb) as all other routines that need this
kind of callback.
......
......@@ -106,6 +106,8 @@ STACK *sk_dup(STACK *sk)
ret->comp=sk->comp;
return(ret);
err:
if(ret)
sk_free(ret);
return(NULL);
}
......@@ -120,9 +122,9 @@ STACK *sk_new(int (*c)(const char * const *, const char * const *))
int i;
if ((ret=(STACK *)OPENSSL_malloc(sizeof(STACK))) == NULL)
goto err0;
goto err;
if ((ret->data=(char **)OPENSSL_malloc(sizeof(char *)*MIN_NODES)) == NULL)
goto err1;
goto err;
for (i=0; i<MIN_NODES; i++)
ret->data[i]=NULL;
ret->comp=c;
......@@ -130,9 +132,9 @@ STACK *sk_new(int (*c)(const char * const *, const char * const *))
ret->num=0;
ret->sorted=0;
return(ret);
err1:
OPENSSL_free(ret);
err0:
err:
if(ret)
OPENSSL_free(ret);
return(NULL);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册