Fix memory leak in req_cb() of x_req.c - handle distinguishing_id also with NO_SM2
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Mon, 28 Sep 2020 08:31:46 +0000 (10:31 +0200)
committerDr. David von Oheimb <David.von.Oheimb@siemens.com>
Thu, 1 Oct 2020 12:13:18 +0000 (14:13 +0200)
Was detected via test_req_distinguishing_id() with config having no-ec but not no-sm2

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/13021)

crypto/x509/x_req.c

index 21215b4778001712152acc4eefe7eff41118dfd5..e821ffdb788d2448c30fc0dbf12335ba87795695 100644 (file)
@@ -48,7 +48,6 @@ static int rinf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
 static int req_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
                   void *exarg)
 {
-#ifndef OPENSSL_NO_SM2
     X509_REQ *ret = (X509_REQ *)*pval;
 
     switch (operation) {
@@ -63,7 +62,6 @@ static int req_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
         ASN1_OCTET_STRING_free(ret->distinguishing_id);
         break;
     }
-#endif
 
     return 1;
 }