]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: memleaks; found by valgrind
authordjm@openbsd.org <djm@openbsd.org>
Mon, 16 Jul 2018 03:09:13 +0000 (03:09 +0000)
committerDamien Miller <djm@mindrot.org>
Mon, 16 Jul 2018 03:12:20 +0000 (13:12 +1000)
OpenBSD-Commit-ID: 6c3ba22be53e753c899545f771e8399fc93cd844

hostfile.c
packet.c

index e0833937998d0db9aab9cee94b488239a11b4ead..e1f826bddc9e27b13e12f939df55c48144294beb 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: hostfile.c,v 1.72 2018/06/06 18:29:18 markus Exp $ */
+/* $OpenBSD: hostfile.c,v 1.73 2018/07/16 03:09:13 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -683,11 +683,11 @@ hostkeys_foreach(const char *path, hostkeys_foreach_fn *callback, void *ctx,
                linenum++;
                line[strcspn(line, "\n")] = '\0';
 
+               free(lineinfo.line);
                sshkey_free(lineinfo.key);
                memset(&lineinfo, 0, sizeof(lineinfo));
                lineinfo.path = path;
                lineinfo.linenum = linenum;
-               free(lineinfo.line);
                lineinfo.line = xstrdup(line);
                lineinfo.marker = MRK_NONE;
                lineinfo.status = HKF_STATUS_OK;
index cacb6eebef119be99f7b227dbfc35806961d5b34..0ae65bd3236129ee1c569698187442c7ee969cf4 100644 (file)
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.276 2018/07/09 21:03:30 markus Exp $ */
+/* $OpenBSD: packet.c,v 1.277 2018/07/16 03:09:13 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -622,6 +622,8 @@ ssh_packet_close_internal(struct ssh *ssh, int do_close)
        cipher_free(state->receive_context);
        state->send_context = state->receive_context = NULL;
        if (do_close) {
+               free(ssh->local_ipaddr);
+               ssh->local_ipaddr = NULL;
                free(ssh->remote_ipaddr);
                ssh->remote_ipaddr = NULL;
                free(ssh->state);