From: tb Date: Tue, 30 Aug 2022 08:45:06 +0000 (+0000) Subject: Plug memory leak in X509_REQ_print_ex() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d2477c1a29662f78664eb7f345cb339a1064d404;p=openbsd Plug memory leak in X509_REQ_print_ex() CID 356353 ok jsing --- diff --git a/lib/libcrypto/asn1/t_req.c b/lib/libcrypto/asn1/t_req.c index 4b27a4ddbe1..81f7dd29e87 100644 --- a/lib/libcrypto/asn1/t_req.c +++ b/lib/libcrypto/asn1/t_req.c @@ -1,4 +1,4 @@ -/* $OpenBSD: t_req.c,v 1.22 2022/05/09 19:19:33 jsing Exp $ */ +/* $OpenBSD: t_req.c,v 1.23 2022/08/30 08:45:06 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -102,7 +102,7 @@ X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, X509_REQ_INFO *ri; EVP_PKEY *pkey; STACK_OF(X509_ATTRIBUTE) *sk; - STACK_OF(X509_EXTENSION) *exts; + STACK_OF(X509_EXTENSION) *exts = NULL; char mlch = ' '; int nmindent = 0; @@ -238,6 +238,7 @@ X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, goto err; } sk_X509_EXTENSION_pop_free(exts, X509_EXTENSION_free); + exts = NULL; } } @@ -249,6 +250,7 @@ X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, return (1); err: + sk_X509_EXTENSION_pop_free(exts, X509_EXTENSION_free); X509error(ERR_R_BUF_LIB); return (0); }