diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2023-08-22 08:09:37 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2023-08-22 08:09:37 +0000 |
commit | 147a5b269a5fe59caffe44873b1bbba8c2142b68 (patch) | |
tree | 36d996583e632404ff063e3a1c1e080070ebe846 /lib | |
parent | 606bc412d6a15ef035e368c942f84b9c277bcd70 (diff) |
Plug a leak of ASN1_INTEGR in def_serial_cb()
ok jsing
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libcrypto/ts/ts_rsp_sign.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/libcrypto/ts/ts_rsp_sign.c b/lib/libcrypto/ts/ts_rsp_sign.c index 84a69931060..3013cffbc5e 100644 --- a/lib/libcrypto/ts/ts_rsp_sign.c +++ b/lib/libcrypto/ts/ts_rsp_sign.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ts_rsp_sign.c,v 1.31 2023/07/07 07:25:21 beck Exp $ */ +/* $OpenBSD: ts_rsp_sign.c,v 1.32 2023/08/22 08:09:36 tb Exp $ */ /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL * project 2002. */ @@ -98,18 +98,21 @@ static ASN1_GENERALIZEDTIME *TS_RESP_set_genTime_with_precision( static ASN1_INTEGER * def_serial_cb(struct TS_resp_ctx *ctx, void *data) { - ASN1_INTEGER *serial = ASN1_INTEGER_new(); + ASN1_INTEGER *serial; - if (!serial) + if ((serial = ASN1_INTEGER_new()) == NULL) goto err; if (!ASN1_INTEGER_set(serial, 1)) goto err; + return serial; -err: + err: + ASN1_INTEGER_free(serial); TSerror(ERR_R_MALLOC_FAILURE); TS_RESP_CTX_set_status_info(ctx, TS_STATUS_REJECTION, "Error during serial number generation."); + return NULL; } |