From 64e747d5d1edaa2203e762449fbec33bff6ba25e Mon Sep 17 00:00:00 2001 From: Tobias Weingartner Date: Sat, 2 Jan 1999 08:30:28 +0000 Subject: Fix possible free() of uninitialized pointer. --- bin/rm/rm.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'bin/rm') diff --git a/bin/rm/rm.c b/bin/rm/rm.c index 7b9730647d4..f723e0b32d8 100644 --- a/bin/rm/rm.c +++ b/bin/rm/rm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rm.c,v 1.7 1998/11/04 21:52:41 aaron Exp $ */ +/* $OpenBSD: rm.c,v 1.8 1999/01/02 08:30:27 weingart Exp $ */ /* $NetBSD: rm.c,v 1.19 1995/09/07 06:48:50 jtc Exp $ */ /*- @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)rm.c 8.8 (Berkeley) 4/27/95"; #else -static char rcsid[] = "$OpenBSD: rm.c,v 1.7 1998/11/04 21:52:41 aaron Exp $"; +static char rcsid[] = "$OpenBSD: rm.c,v 1.8 1999/01/02 08:30:27 weingart Exp $"; #endif #endif /* not lint */ @@ -314,7 +314,7 @@ rm_overwrite(file, sbp) struct statfs fsb; off_t len; int bsize, fd, wlen; - char *buf; + char *buf = NULL; fd = -1; if (sbp == NULL) { @@ -353,7 +353,8 @@ rm_overwrite(file, sbp) } err: eval = 1; - free(buf); + if(buf) + free(buf); warn("%s", file); } -- cgit v1.2.3