diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2023-12-14 18:12:52 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2023-12-14 18:12:52 +0000 |
commit | d39b922c6997cde7477aad7f83c32d4c420d9c9e (patch) | |
tree | e7ae4adc8b6ccaabec6e6a5a6259000648aab59f /lib/libcrypto/objects | |
parent | aece28af4b2fc4ad5a2b661c3e539d014e2b4fbf (diff) |
OBJ_create: initialize buf and turn function into single exit
Diffstat (limited to 'lib/libcrypto/objects')
-rw-r--r-- | lib/libcrypto/objects/obj_dat.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libcrypto/objects/obj_dat.c b/lib/libcrypto/objects/obj_dat.c index b58e8cfe949..600c3a66a60 100644 --- a/lib/libcrypto/objects/obj_dat.c +++ b/lib/libcrypto/objects/obj_dat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: obj_dat.c,v 1.75 2023/12/14 18:10:32 tb Exp $ */ +/* $OpenBSD: obj_dat.c,v 1.76 2023/12/14 18:12:51 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -590,17 +590,17 @@ int OBJ_create(const char *oid, const char *sn, const char *ln) { ASN1_OBJECT *op = NULL; - unsigned char *buf; + unsigned char *buf = NULL; int len; int ret = 0; len = a2d_ASN1_OBJECT(NULL, 0, oid, -1); if (len <= 0) - return 0; + goto err; if ((buf = malloc(len)) == NULL) { OBJerror(ERR_R_MALLOC_FAILURE); - return 0; + goto err; } len = a2d_ASN1_OBJECT(buf, len, oid, -1); if (len == 0) @@ -613,6 +613,7 @@ OBJ_create(const char *oid, const char *sn, const char *ln) err: ASN1_OBJECT_free(op); free(buf); + return ret; } LCRYPTO_ALIAS(OBJ_create); |