Restore a check before BN_free() that needs to exist and write it such that
authorjsing <jsing@openbsd.org>
Wed, 7 Feb 2018 08:57:25 +0000 (08:57 +0000)
committerjsing <jsing@openbsd.org>
Wed, 7 Feb 2018 08:57:25 +0000 (08:57 +0000)
the intent is more obvious.

usr.bin/openssl/apps.c

index 22b6b28..90baf65 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: apps.c,v 1.46 2018/02/07 05:47:55 jsing Exp $ */
+/* $OpenBSD: apps.c,v 1.47 2018/02/07 08:57:25 jsing Exp $ */
 /*
  * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
  *
@@ -1425,7 +1425,8 @@ rand_serial(BIGNUM *b, ASN1_INTEGER *ai)
        ret = 1;
 
  error:
-       BN_free(btmp);
+       if (b != btmp)
+               BN_free(btmp);
 
        return ret;
 }