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:06:10 +0000 (00:06 +0000)
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
(cherry picked from commit bb1ddd3d9a0d01656b90693a214b911995a5fe8c)

ssl/d1_srvr.c
ssl/s23_srvr.c

index 139f5f39a4130c495db3966fe2180faad96471e6..a14fb43138b1997662a41022a70990dbbaaef9f3 100644 (file)
@@ -209,6 +209,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 f1974e0e3b3186ec5a1d351ed4e0ec4547bb9b87..d2b3317c4d147d36ebc6fb1039b09850b3300f53 100644 (file)
@@ -185,6 +185,7 @@ int ssl23_accept(SSL *s)
                                        }
                                if (!BUF_MEM_grow(buf,SSL3_RT_MAX_PLAIN_LENGTH))
                                        {
+                                       BUF_MEM_free(buf);
                                        ret= -1;
                                        goto end;
                                        }