summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorweingart <weingart@openbsd.org>1999-01-02 08:30:27 +0000
committerweingart <weingart@openbsd.org>1999-01-02 08:30:27 +0000
commit4ac1cca315cd00718abe94d16c5450002d69ebe4 (patch)
tree457b8a618958c570dca9fa361696e7bb5281e740
parentClean up some -Wall stuff, and a potential problem if TM_TIME_BASE was not (diff)
downloadwireguard-openbsd-4ac1cca315cd00718abe94d16c5450002d69ebe4.tar.xz
wireguard-openbsd-4ac1cca315cd00718abe94d16c5450002d69ebe4.zip
Fix possible free() of uninitialized pointer.
-rw-r--r--bin/rm/rm.c9
1 files changed, 5 insertions, 4 deletions
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);
}