free NULL cleanup
[openssl.git] / crypto / asn1 / asn_mime.c
index 28622f28155d0861482e3c67696b033a4939e085..e810345579e23ada85308e34b8e223c181694bb6 100644 (file)
@@ -286,7 +286,8 @@ int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
     if ((flags & SMIME_DETACHED) && data) {
         /* We want multipart/signed */
         /* Generate a random boundary */
-        RAND_pseudo_bytes((unsigned char *)bound, 32);
+        if (RAND_bytes((unsigned char *)bound, 32) <= 0)
+            return 0;
         for (i = 0; i < 32; i++) {
             c = bound[i] & 0xf;
             if (c < 10)
@@ -649,8 +650,7 @@ static int multi_split(BIO *bio, char *bound, STACK_OF(BIO) **ret)
                 BIO_write(bpart, linebuf, len);
         }
     }
-    if (bpart != NULL)
-        BIO_free(bpart);
+    BIO_free(bpart);
     return 0;
 }