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:05:52 +0000 (00:05 +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 6a075b33969f9e0844ffbbf2d5a70030107b4774..a5660bc25b4457ead2e1a11132d7b3d005f24d4a 100644 (file)
@@ -233,6 +233,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 de909b180851450effed5305614f6b5ab74009a3..3178815ec99b7f4826eda1ab971e8a16652d2d32 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;
                                        }