Fixed memory leak if BUF_MEM_grow fails
authorMatt Caswell <matt@openssl.org>
Fri, 12 Dec 2014 11:03:00 +0000 (11:03 +0000)
committerMatt Caswell <matt@openssl.org>
Sat, 13 Dec 2014 00:03:58 +0000 (00:03 +0000)
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
ssl/d1_srvr.c
ssl/s23_srvr.c

index 084118375f78350b85f560ca1f35b07a3f1bc093..5f15467f806ca9746ba158c08858f17c15c8fbf2 100644 (file)
@@ -251,6 +251,7 @@ int dtls1_accept(SSL *s)
                                        }
                                if (!BUF_MEM_grow(buf,SSL3_RT_MAX_PLAIN_LENGTH))
                                        {
+                                       BUF_MEM_free(buf);
                                        ret= -1;
                                        goto end;
                                        }
index e656ac234c6cdd9df4dfe04ede58f1b2d3bde98d..9840d474d5872eb891e5a604d084715ba75b6c26 100644 (file)
@@ -192,6 +192,7 @@ int ssl23_accept(SSL *s)
                                        }
                                if (!BUF_MEM_grow(buf,SSL3_RT_MAX_PLAIN_LENGTH))
                                        {
+                                       BUF_MEM_free(buf);
                                        ret= -1;
                                        goto end;
                                        }