]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream commit
authorgsoares@openbsd.org <gsoares@openbsd.org>
Wed, 21 Oct 2015 11:33:03 +0000 (11:33 +0000)
committerDamien Miller <djm@mindrot.org>
Sun, 25 Oct 2015 00:42:04 +0000 (11:42 +1100)
fix memory leak in error path ok djm@

Upstream-ID: dd2f402b0a0029b755df029fc7f0679e1365ce35

packet.c

index 9cf09e201426d2e473458b370b5bd956c6f611d1..a0dbc2391e29a144bcfcf75f7c737b2ee819ea93 100644 (file)
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.215 2015/09/21 04:31:00 djm Exp $ */
+/* $OpenBSD: packet.c,v 1.216 2015/10/21 11:33:03 gsoares Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -2040,8 +2040,10 @@ ssh_packet_write_wait(struct ssh *ssh)
            NFDBITS), sizeof(fd_mask));
        if (setp == NULL)
                return SSH_ERR_ALLOC_FAIL;
-       if ((r = ssh_packet_write_poll(ssh)) != 0)
+       if ((r = ssh_packet_write_poll(ssh)) != 0) {
+               free(setp);
                return r;
+       }
        while (ssh_packet_have_data_to_write(ssh)) {
                memset(setp, 0, howmany(state->connection_out + 1,
                    NFDBITS) * sizeof(fd_mask));