summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/packet.c
diff options
context:
space:
mode:
authormmcc <mmcc@cvs.openbsd.org>2015-12-10 17:08:41 +0000
committermmcc <mmcc@cvs.openbsd.org>2015-12-10 17:08:41 +0000
commit3c08fdfac640be5d0cf1ab7cd3cdcc80fb1fb219 (patch)
treeccf4d2f745a868258b702abef3b4971740766edb /usr.bin/ssh/packet.c
parentbefdcdf0b9b3dd6f91be8c8b79338e73de57c152 (diff)
Remove NULL-checks before free().
ok dtucker@
Diffstat (limited to 'usr.bin/ssh/packet.c')
-rw-r--r--usr.bin/ssh/packet.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/usr.bin/ssh/packet.c b/usr.bin/ssh/packet.c
index d0d5055d5d4..c75313e7f05 100644
--- a/usr.bin/ssh/packet.c
+++ b/usr.bin/ssh/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.218 2015/12/04 16:41:28 markus Exp $ */
+/* $OpenBSD: packet.c,v 1.219 2015/12/10 17:08:40 mmcc Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -508,10 +508,8 @@ ssh_packet_close(struct ssh *ssh)
error("%s: cipher_cleanup failed: %s", __func__, ssh_err(r));
if ((r = cipher_cleanup(&state->receive_context)) != 0)
error("%s: cipher_cleanup failed: %s", __func__, ssh_err(r));
- if (ssh->remote_ipaddr) {
- free(ssh->remote_ipaddr);
- ssh->remote_ipaddr = NULL;
- }
+ free(ssh->remote_ipaddr);
+ ssh->remote_ipaddr = NULL;
free(ssh->state);
ssh->state = NULL;
}
@@ -1772,8 +1770,7 @@ ssh_packet_read_poll_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
if ((r = sshpkt_get_u8(ssh, NULL)) != 0 ||
(r = sshpkt_get_string(ssh, &msg, NULL)) != 0 ||
(r = sshpkt_get_string(ssh, NULL, NULL)) != 0) {
- if (msg)
- free(msg);
+ free(msg);
return r;
}
debug("Remote: %.900s", msg);
@@ -2550,8 +2547,7 @@ newkeys_from_blob(struct sshbuf *m, struct ssh *ssh, int mode)
newkey = NULL;
r = 0;
out:
- if (newkey != NULL)
- free(newkey);
+ free(newkey);
if (b != NULL)
sshbuf_free(b);
return r;