summaryrefslogtreecommitdiff
path: root/channels.c
diff options
context:
space:
mode:
authorjsg@openbsd.org <jsg@openbsd.org>2020-02-26 13:40:09 +0000
committerDamien Miller <djm@mindrot.org>2020-02-28 12:26:28 +1100
commitd5ba1c03278eb079438bb038266d80d7477d49cb (patch)
tree6d8dd2d802af796bcb7c9d6d018196a448bb9ff6 /channels.c
parent9e3220b585c5be19a7431ea4ff8884c137b3a81c (diff)
upstream: change explicit_bzero();free() to freezero()
While freezero() returns early if the pointer is NULL the tests for NULL in callers are left to avoid warnings about passing an uninitialised size argument across a function boundry. ok deraadt@ djm@ OpenBSD-Commit-ID: 2660fa334fcc7cd05ec74dd99cb036f9ade6384a
Diffstat (limited to 'channels.c')
-rw-r--r--channels.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/channels.c b/channels.c
index 226ba7a39..19c22c4ef 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.c,v 1.395 2020/01/25 06:40:20 djm Exp $ */ 1/* $OpenBSD: channels.c,v 1.396 2020/02/26 13:40:09 jsg 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
@@ -625,14 +625,12 @@ channel_free(struct ssh *ssh, Channel *c)
625 if (cc->abandon_cb != NULL) 625 if (cc->abandon_cb != NULL)
626 cc->abandon_cb(ssh, c, cc->ctx); 626 cc->abandon_cb(ssh, c, cc->ctx);
627 TAILQ_REMOVE(&c->status_confirms, cc, entry); 627 TAILQ_REMOVE(&c->status_confirms, cc, entry);
628 explicit_bzero(cc, sizeof(*cc)); 628 freezero(cc, sizeof(*cc));
629 free(cc);
630 } 629 }
631 if (c->filter_cleanup != NULL && c->filter_ctx != NULL) 630 if (c->filter_cleanup != NULL && c->filter_ctx != NULL)
632 c->filter_cleanup(ssh, c->self, c->filter_ctx); 631 c->filter_cleanup(ssh, c->self, c->filter_ctx);
633 sc->channels[c->self] = NULL; 632 sc->channels[c->self] = NULL;
634 explicit_bzero(c, sizeof(*c)); 633 freezero(c, sizeof(*c));
635 free(c);
636} 634}
637 635
638void 636void
@@ -3295,8 +3293,7 @@ channel_input_status_confirm(int type, u_int32_t seq, struct ssh *ssh)
3295 return 0; 3293 return 0;
3296 cc->cb(ssh, type, c, cc->ctx); 3294 cc->cb(ssh, type, c, cc->ctx);
3297 TAILQ_REMOVE(&c->status_confirms, cc, entry); 3295 TAILQ_REMOVE(&c->status_confirms, cc, entry);
3298 explicit_bzero(cc, sizeof(*cc)); 3296 freezero(cc, sizeof(*cc));
3299 free(cc);
3300 return 0; 3297 return 0;
3301} 3298}
3302 3299