summaryrefslogtreecommitdiff
path: root/packet.c
diff options
context:
space:
mode:
authormmcc@openbsd.org <mmcc@openbsd.org>2015-12-10 17:08:40 +0000
committerDamien Miller <djm@mindrot.org>2015-12-11 13:23:14 +1100
commitd59ce08811bf94111c2f442184cf7d1257ffae24 (patch)
tree5885ad687f762834250c9c3f5b53b3f1b750c9f1 /packet.c
parent8e56dd46cb37879c73bce2d6032cf5e7f82d5a71 (diff)
upstream commit
Remove NULL-checks before free(). ok dtucker@ Upstream-ID: e3d3cb1ce900179906af36517b5eea0fb15e6ef8
Diffstat (limited to 'packet.c')
-rw-r--r--packet.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/packet.c b/packet.c
index 378906956..06e16536c 100644
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: packet.c,v 1.218 2015/12/04 16:41:28 markus Exp $ */ 1/* $OpenBSD: packet.c,v 1.219 2015/12/10 17:08:40 mmcc Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -519,10 +519,8 @@ ssh_packet_close(struct ssh *ssh)
519 error("%s: cipher_cleanup failed: %s", __func__, ssh_err(r)); 519 error("%s: cipher_cleanup failed: %s", __func__, ssh_err(r));
520 if ((r = cipher_cleanup(&state->receive_context)) != 0) 520 if ((r = cipher_cleanup(&state->receive_context)) != 0)
521 error("%s: cipher_cleanup failed: %s", __func__, ssh_err(r)); 521 error("%s: cipher_cleanup failed: %s", __func__, ssh_err(r));
522 if (ssh->remote_ipaddr) { 522 free(ssh->remote_ipaddr);
523 free(ssh->remote_ipaddr); 523 ssh->remote_ipaddr = NULL;
524 ssh->remote_ipaddr = NULL;
525 }
526 free(ssh->state); 524 free(ssh->state);
527 ssh->state = NULL; 525 ssh->state = NULL;
528} 526}
@@ -1784,8 +1782,7 @@ ssh_packet_read_poll_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
1784 if ((r = sshpkt_get_u8(ssh, NULL)) != 0 || 1782 if ((r = sshpkt_get_u8(ssh, NULL)) != 0 ||
1785 (r = sshpkt_get_string(ssh, &msg, NULL)) != 0 || 1783 (r = sshpkt_get_string(ssh, &msg, NULL)) != 0 ||
1786 (r = sshpkt_get_string(ssh, NULL, NULL)) != 0) { 1784 (r = sshpkt_get_string(ssh, NULL, NULL)) != 0) {
1787 if (msg) 1785 free(msg);
1788 free(msg);
1789 return r; 1786 return r;
1790 } 1787 }
1791 debug("Remote: %.900s", msg); 1788 debug("Remote: %.900s", msg);
@@ -2570,8 +2567,7 @@ newkeys_from_blob(struct sshbuf *m, struct ssh *ssh, int mode)
2570 newkey = NULL; 2567 newkey = NULL;
2571 r = 0; 2568 r = 0;
2572 out: 2569 out:
2573 if (newkey != NULL) 2570 free(newkey);
2574 free(newkey);
2575 if (b != NULL) 2571 if (b != NULL)
2576 sshbuf_free(b); 2572 sshbuf_free(b);
2577 return r; 2573 return r;