From: gsoares Date: Wed, 21 Oct 2015 11:33:03 +0000 (+0000) Subject: fix memory leak in error path X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=030798fdb9cafe76df0d17a336a02a4e9712f079;p=openbsd fix memory leak in error path ok djm@ --- diff --git a/usr.bin/ssh/packet.c b/usr.bin/ssh/packet.c index 110e0c3acb5..a5ca6855108 100644 --- a/usr.bin/ssh/packet.c +++ b/usr.bin/ssh/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 * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -2027,8 +2027,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));