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:02:20 +0000 (00:02 +0000)
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
ssl/d1_srvr.c
ssl/s23_srvr.c

index aef38bb75429817e8c2b2c018795f2c45330d882..0cdc51be23e63047fea2ebc5815ccef0e31c0c38 100644 (file)
@@ -251,6 +251,7 @@ int dtls1_accept(SSL *s)
                                        }
                                if (!BUF_MEM_grow(buf,SSL3_RT_MAX_PLAIN_LENGTH))
                                        {
                                        }
                                if (!BUF_MEM_grow(buf,SSL3_RT_MAX_PLAIN_LENGTH))
                                        {
+                                       BUF_MEM_free(buf);
                                        ret= -1;
                                        goto end;
                                        }
                                        ret= -1;
                                        goto end;
                                        }
index 08aa5b6cf0882366c014b47290177dcbf3393458..6e44e0cd64ef4ff2fbb26558830e730fef2cbd6d 100644 (file)
@@ -185,6 +185,7 @@ int ssl23_accept(SSL *s)
                                        }
                                if (!BUF_MEM_grow(buf,SSL3_RT_MAX_PLAIN_LENGTH))
                                        {
                                        }
                                if (!BUF_MEM_grow(buf,SSL3_RT_MAX_PLAIN_LENGTH))
                                        {
+                                       BUF_MEM_free(buf);
                                        ret= -1;
                                        goto end;
                                        }
                                        ret= -1;
                                        goto end;
                                        }