summaryrefslogtreecommitdiffstats
path: root/usr.sbin/makefs
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2020-04-09 16:19:00 +0000
committerkrw <krw@openbsd.org>2020-04-09 16:19:00 +0000
commit1f04af5722787a8906351818148e52e2cc48270d (patch)
tree07c0901a29cdbcecf2a0775c09ad32201d5f610e /usr.sbin/makefs
parentNo need to check for NULL before free(). (diff)
downloadwireguard-openbsd-1f04af5722787a8906351818148e52e2cc48270d.tar.xz
wireguard-openbsd-1f04af5722787a8906351818148e52e2cc48270d.zip
No need to check for NULL before free().
From Geoff Hill.
Diffstat (limited to 'usr.sbin/makefs')
-rw-r--r--usr.sbin/makefs/ffs.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/usr.sbin/makefs/ffs.c b/usr.sbin/makefs/ffs.c
index 9bd90e67789..8c9c00d6dc7 100644
--- a/usr.sbin/makefs/ffs.c
+++ b/usr.sbin/makefs/ffs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs.c,v 1.31 2017/01/21 21:58:32 natano Exp $ */
+/* $OpenBSD: ffs.c,v 1.32 2020/04/09 16:19:00 krw Exp $ */
/* $NetBSD: ffs.c,v 1.66 2015/12/21 00:58:08 christos Exp $ */
/*
@@ -448,8 +448,7 @@ ffs_create_image(const char *image, fsinfo_t *fsopts)
}
bufrem -= i;
}
- if (buf)
- free(buf);
+ free(buf);
/* make the file system */
if (Tflag) {
@@ -706,8 +705,7 @@ ffs_populate_dir(const char *dir, fsnode *root, fsinfo_t *fsopts)
}
/* cleanup */
- if (dirbuf.buf != NULL)
- free(dirbuf.buf);
+ free(dirbuf.buf);
return (1);
}
@@ -803,8 +801,7 @@ ffs_write_file(union dinode *din, uint32_t ino, void *buf, fsinfo_t *fsopts)
ffs_write_inode(&in.i_din, in.i_number, fsopts);
leave_ffs_write_file:
- if (fbuf)
- free(fbuf);
+ free(fbuf);
if (ffd != -1)
close(ffd);
}