Plug potential memory leak.
authorRichard Levitte <levitte@openssl.org>
Wed, 30 Oct 2002 09:42:42 +0000 (09:42 +0000)
committerRichard Levitte <levitte@openssl.org>
Wed, 30 Oct 2002 09:42:42 +0000 (09:42 +0000)
Identified by Goetz Babin-Ebell <babinebell@trustcenter.de>

crypto/pem/pem_lib.c

index 7066e67..bfc43e9 100644 (file)
@@ -251,7 +251,7 @@ int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, const char
        ret = 1;
 
 err:
-       if (!pnm) OPENSSL_free(nm);
+       if (!ret || !pnm) OPENSSL_free(nm);
        OPENSSL_free(header);
        if (!ret) OPENSSL_free(data);
        return ret;