diff options
author | mmcc <mmcc@cvs.openbsd.org> | 2015-12-11 20:15:53 +0000 |
---|---|---|
committer | mmcc <mmcc@cvs.openbsd.org> | 2015-12-11 20:15:53 +0000 |
commit | 9bb1c20bfdf4ef186cc5f694766df575698c523d (patch) | |
tree | 08dda59b3dcc60f0c3a31e10ae12a6ccc94c74f0 /usr.sbin/rtadvd | |
parent | a6f383a26c7edc7e2d39742e9ebd5bcb5c939cf3 (diff) |
Remove NULL-checks before free().
Diffstat (limited to 'usr.sbin/rtadvd')
-rw-r--r-- | usr.sbin/rtadvd/config.c | 10 | ||||
-rw-r--r-- | usr.sbin/rtadvd/dump.c | 14 | ||||
-rw-r--r-- | usr.sbin/rtadvd/if.c | 5 |
3 files changed, 11 insertions, 18 deletions
diff --git a/usr.sbin/rtadvd/config.c b/usr.sbin/rtadvd/config.c index ee3996ad1f8..e340d9ca97c 100644 --- a/usr.sbin/rtadvd/config.c +++ b/usr.sbin/rtadvd/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.44 2015/10/25 22:11:34 jca Exp $ */ +/* $OpenBSD: config.c,v 1.45 2015/12/11 20:15:52 mmcc Exp $ */ /* $KAME: config.c,v 1.62 2002/05/29 10:13:10 itojun Exp $ */ /* @@ -807,11 +807,9 @@ make_packet(struct rainfo *rainfo) /* allocate memory for the packet */ if ((buf = malloc(packlen)) == NULL) fatal("malloc"); - if (rainfo->ra_data) { - /* free the previous packet */ - free(rainfo->ra_data); - rainfo->ra_data = NULL; - } + /* free the previous packet */ + free(rainfo->ra_data); + rainfo->ra_data = NULL; rainfo->ra_data = buf; /* XXX: what if packlen > 576? */ rainfo->ra_datalen = packlen; diff --git a/usr.sbin/rtadvd/dump.c b/usr.sbin/rtadvd/dump.c index 16d860e3b7f..34b26403782 100644 --- a/usr.sbin/rtadvd/dump.c +++ b/usr.sbin/rtadvd/dump.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dump.c,v 1.16 2015/10/25 22:11:34 jca Exp $ */ +/* $OpenBSD: dump.c,v 1.17 2015/12/11 20:15:52 mmcc Exp $ */ /* $KAME: dump.c,v 1.27 2002/05/29 14:23:55 itojun Exp $ */ /* @@ -204,14 +204,10 @@ rtadvd_dump(void) vltime, (vltimexpire)? vltimexpire : "", pltime, (pltimexpire)? pltimexpire : "", flags); - if (vltimexpire) { - free(vltimexpire); - vltimexpire = NULL; - } - if (pltimexpire) { - free(pltimexpire); - pltimexpire = NULL; - } + free(vltimexpire); + vltimexpire = NULL; + free(pltimexpire); + pltimexpire = NULL; free(vltime); free(pltime); free(flags); diff --git a/usr.sbin/rtadvd/if.c b/usr.sbin/rtadvd/if.c index a1a2e221c10..0b68beebffe 100644 --- a/usr.sbin/rtadvd/if.c +++ b/usr.sbin/rtadvd/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.34 2015/12/01 12:11:31 jca Exp $ */ +/* $OpenBSD: if.c,v 1.35 2015/12/11 20:15:52 mmcc Exp $ */ /* $KAME: if.c,v 1.17 2001/01/21 15:27:30 itojun Exp $ */ /* @@ -503,8 +503,7 @@ init_iflist(void) free(ifblock); ifblock_size = 0; } - if (iflist) - free(iflist); + free(iflist); /* get iflist block from kernel */ get_iflist(&ifblock, &ifblock_size); |