summaryrefslogtreecommitdiff
path: root/usr.bin/nm
diff options
context:
space:
mode:
authormmcc <mmcc@cvs.openbsd.org>2015-12-09 19:28:35 +0000
committermmcc <mmcc@cvs.openbsd.org>2015-12-09 19:28:35 +0000
commit1785c97cf6451766a29800a9fd5b0bfe0f1986a7 (patch)
treedc7613302c6454837b76d688aa7a630a7264550b /usr.bin/nm
parent717f42c8168fcfddf591cba3ecf226cf61cd032f (diff)
Remove NULL-checks before free(). ok tb@
Diffstat (limited to 'usr.bin/nm')
-rw-r--r--usr.bin/nm/elf.c8
-rw-r--r--usr.bin/nm/nm.c8
2 files changed, 6 insertions, 10 deletions
diff --git a/usr.bin/nm/elf.c b/usr.bin/nm/elf.c
index 7458af512ce..2c7676b1b13 100644
--- a/usr.bin/nm/elf.c
+++ b/usr.bin/nm/elf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: elf.c,v 1.33 2015/08/13 19:13:28 miod Exp $ */
+/* $OpenBSD: elf.c,v 1.34 2015/12/09 19:28:34 mmcc Exp $ */
/*
* Copyright (c) 2003 Michael Shalayeff
@@ -590,10 +590,8 @@ elf_symload(const char *name, FILE *fp, off_t foff, Elf_Ehdr *eh,
free(shstr);
if (stab == NULL) {
warnx("%s: no name list", name);
- if (*pnames)
- free(*pnames);
- if (*psnames)
- free(*psnames);
+ free(*pnames);
+ free(*psnames);
return (1);
}
diff --git a/usr.bin/nm/nm.c b/usr.bin/nm/nm.c
index 673f2ee06c5..5d2a1bfeb61 100644
--- a/usr.bin/nm/nm.c
+++ b/usr.bin/nm/nm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nm.c,v 1.50 2015/11/13 15:22:44 deraadt Exp $ */
+/* $OpenBSD: nm.c,v 1.51 2015/12/09 19:28:34 mmcc Exp $ */
/* $NetBSD: nm.c,v 1.7 1996/01/14 23:04:03 pk Exp $ */
/*
@@ -617,10 +617,8 @@ skip: if (fseeko(fp, last_ar_off + even(mmbrlen), SEEK_SET)) {
break;
}
}
- if (nametab) {
- free(nametab);
- nametab = NULL;
- }
+ free(nametab);
+ nametab = NULL;
free(name);
return(rval);
}