summaryrefslogtreecommitdiff
path: root/bin/rm
diff options
context:
space:
mode:
authorTobias Weingartner <weingart@cvs.openbsd.org>1999-01-02 08:30:28 +0000
committerTobias Weingartner <weingart@cvs.openbsd.org>1999-01-02 08:30:28 +0000
commit64e747d5d1edaa2203e762449fbec33bff6ba25e (patch)
treea877b170fa9fb53bd0dbc6c2483787c31b3b11ec /bin/rm
parent4337ecbb12a813b40d4fd37980ada605f6719742 (diff)
Fix possible free() of uninitialized pointer.
Diffstat (limited to 'bin/rm')
-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);
}