From 7d9906cf5784b21f9d2afab98129af86715d51d8 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Wed, 26 Feb 2020 13:40:10 +0000 Subject: 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@ --- usr.bin/ssh/channels.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'usr.bin/ssh/channels.c') diff --git a/usr.bin/ssh/channels.c b/usr.bin/ssh/channels.c index 41a18f71c62..d321a0d4126 100644 --- a/usr.bin/ssh/channels.c +++ b/usr.bin/ssh/channels.c @@ -1,4 +1,4 @@ -/* $OpenBSD: channels.c,v 1.395 2020/01/25 06:40:20 djm Exp $ */ +/* $OpenBSD: channels.c,v 1.396 2020/02/26 13:40:09 jsg Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -615,14 +615,12 @@ channel_free(struct ssh *ssh, Channel *c) if (cc->abandon_cb != NULL) cc->abandon_cb(ssh, c, cc->ctx); TAILQ_REMOVE(&c->status_confirms, cc, entry); - explicit_bzero(cc, sizeof(*cc)); - free(cc); + freezero(cc, sizeof(*cc)); } if (c->filter_cleanup != NULL && c->filter_ctx != NULL) c->filter_cleanup(ssh, c->self, c->filter_ctx); sc->channels[c->self] = NULL; - explicit_bzero(c, sizeof(*c)); - free(c); + freezero(c, sizeof(*c)); } void @@ -3262,8 +3260,7 @@ channel_input_status_confirm(int type, u_int32_t seq, struct ssh *ssh) return 0; cc->cb(ssh, type, c, cc->ctx); TAILQ_REMOVE(&c->status_confirms, cc, entry); - explicit_bzero(cc, sizeof(*cc)); - free(cc); + freezero(cc, sizeof(*cc)); return 0; } -- cgit v1.2.3