diff options
author | mmcc <mmcc@cvs.openbsd.org> | 2015-12-19 18:40:31 +0000 |
---|---|---|
committer | mmcc <mmcc@cvs.openbsd.org> | 2015-12-19 18:40:31 +0000 |
commit | f6c09a6efecffcf8710d72987a7b168a5ea941f8 (patch) | |
tree | e78f854993bb87dadd3134c9827b783d6d726f50 /lib/libkvm | |
parent | e69c39b5af8bdd39e398dd8236b1e9c28931837f (diff) |
Remove NULL-checks before free(). ok tb@
Diffstat (limited to 'lib/libkvm')
-rw-r--r-- | lib/libkvm/kvm.c | 14 | ||||
-rw-r--r-- | lib/libkvm/kvm_alpha.c | 8 | ||||
-rw-r--r-- | lib/libkvm/kvm_amd64.c | 9 | ||||
-rw-r--r-- | lib/libkvm/kvm_arm.c | 8 | ||||
-rw-r--r-- | lib/libkvm/kvm_hppa.c | 8 | ||||
-rw-r--r-- | lib/libkvm/kvm_hppa64.c | 8 | ||||
-rw-r--r-- | lib/libkvm/kvm_i386.c | 11 | ||||
-rw-r--r-- | lib/libkvm/kvm_m88k.c | 8 | ||||
-rw-r--r-- | lib/libkvm/kvm_powerpc.c | 8 |
9 files changed, 30 insertions, 52 deletions
diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c index d9878911ef5..4b4d17faffb 100644 --- a/lib/libkvm/kvm.c +++ b/lib/libkvm/kvm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm.c,v 1.58 2015/09/08 15:40:32 dlg Exp $ */ +/* $OpenBSD: kvm.c,v 1.59 2015/12/19 18:40:30 mmcc Exp $ */ /* $NetBSD: kvm.c,v 1.43 1996/05/05 04:31:59 gwr Exp $ */ /*- @@ -411,10 +411,8 @@ _kvm_get_header(kvm_t *kd) return (0); fail: - if (kd->kcore_hdr != NULL) { - free(kd->kcore_hdr); - kd->kcore_hdr = NULL; - } + free(kd->kcore_hdr); + kd->kcore_hdr = NULL; if (kd->cpu_data != NULL) { free(kd->cpu_data); kd->cpu_data = NULL; @@ -507,10 +505,8 @@ kvm_dump_mkheader(kvm_t *kd, off_t dump_off) return (hdr_size); fail: - if (kd->kcore_hdr != NULL) { - free(kd->kcore_hdr); - kd->kcore_hdr = NULL; - } + free(kd->kcore_hdr); + kd->kcore_hdr = NULL; if (kd->cpu_data != NULL) { free(kd->cpu_data); kd->cpu_data = NULL; diff --git a/lib/libkvm/kvm_alpha.c b/lib/libkvm/kvm_alpha.c index ee7f7dbcb77..7f3169e52ef 100644 --- a/lib/libkvm/kvm_alpha.c +++ b/lib/libkvm/kvm_alpha.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm_alpha.c,v 1.15 2013/11/01 15:57:56 deraadt Exp $ */ +/* $OpenBSD: kvm_alpha.c,v 1.16 2015/12/19 18:40:30 mmcc Exp $ */ /* $NetBSD: kvm_alpha.c,v 1.5 1996/10/01 21:12:05 cgd Exp $ */ /* @@ -58,10 +58,8 @@ _kvm_freevtop(kvm_t *kd) { /* Not actually used for anything right now, but safe. */ - if (kd->vmst != NULL) { - free(kd->vmst); - kd->vmst = NULL; - } + free(kd->vmst); + kd->vmst = NULL; } int diff --git a/lib/libkvm/kvm_amd64.c b/lib/libkvm/kvm_amd64.c index 1a284db0e6d..9ab61c14d66 100644 --- a/lib/libkvm/kvm_amd64.c +++ b/lib/libkvm/kvm_amd64.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm_amd64.c,v 1.12 2015/01/16 16:48:51 deraadt Exp $ */ +/* $OpenBSD: kvm_amd64.c,v 1.13 2015/12/19 18:40:30 mmcc Exp $ */ /* $NetBSD: kvm_x86_64.c,v 1.3 2002/06/05 22:01:55 fvdl Exp $ */ /*- @@ -62,12 +62,9 @@ void _kvm_freevtop(kvm_t *kd) { - /* Not actually used for anything right now, but safe. */ - if (kd->vmst != NULL) { - free(kd->vmst); - kd->vmst = NULL; - } + free(kd->vmst); + kd->vmst = NULL; } /*ARGSUSED*/ diff --git a/lib/libkvm/kvm_arm.c b/lib/libkvm/kvm_arm.c index 6e4cfb600f9..98d4fe79803 100644 --- a/lib/libkvm/kvm_arm.c +++ b/lib/libkvm/kvm_arm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm_arm.c,v 1.8 2013/03/28 16:27:31 deraadt Exp $ */ +/* $OpenBSD: kvm_arm.c,v 1.9 2015/12/19 18:40:30 mmcc Exp $ */ /* * Copyright (c) 2006 Miodrag Vallat. * @@ -69,10 +69,8 @@ void _kvm_freevtop(kvm_t *kd) { - if (kd->vmst != NULL) { - free(kd->vmst); - kd->vmst = NULL; - } + free(kd->vmst); + kd->vmst = NULL; } int diff --git a/lib/libkvm/kvm_hppa.c b/lib/libkvm/kvm_hppa.c index 5831e254064..a82379edbef 100644 --- a/lib/libkvm/kvm_hppa.c +++ b/lib/libkvm/kvm_hppa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm_hppa.c,v 1.9 2013/11/01 15:57:56 deraadt Exp $ */ +/* $OpenBSD: kvm_hppa.c,v 1.10 2015/12/19 18:40:30 mmcc Exp $ */ /* * Copyright (c) 2002, Miodrag Vallat. @@ -40,10 +40,8 @@ void _kvm_freevtop(kvm_t *kd) { - if (kd->vmst != NULL) { - free(kd->vmst); - kd->vmst = NULL; - } + free(kd->vmst); + kd->vmst = NULL; } int diff --git a/lib/libkvm/kvm_hppa64.c b/lib/libkvm/kvm_hppa64.c index deaed7d9fec..424f3c63ea6 100644 --- a/lib/libkvm/kvm_hppa64.c +++ b/lib/libkvm/kvm_hppa64.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm_hppa64.c,v 1.3 2013/11/01 15:57:56 deraadt Exp $ */ +/* $OpenBSD: kvm_hppa64.c,v 1.4 2015/12/19 18:40:30 mmcc Exp $ */ /* * Copyright (c) 2002, Miodrag Vallat. @@ -40,10 +40,8 @@ void _kvm_freevtop(kvm_t *kd) { - if (kd->vmst != NULL) { - free(kd->vmst); - kd->vmst = NULL; - } + free(kd->vmst); + kd->vmst = NULL; } int diff --git a/lib/libkvm/kvm_i386.c b/lib/libkvm/kvm_i386.c index 3be661009fc..5c68c43c1f6 100644 --- a/lib/libkvm/kvm_i386.c +++ b/lib/libkvm/kvm_i386.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm_i386.c,v 1.26 2015/04/07 05:50:40 guenther Exp $ */ +/* $OpenBSD: kvm_i386.c,v 1.27 2015/12/19 18:40:30 mmcc Exp $ */ /* $NetBSD: kvm_i386.c,v 1.9 1996/03/18 22:33:38 thorpej Exp $ */ /*- @@ -101,8 +101,7 @@ void _kvm_freevtop(kvm_t *kd) { if (kd->vmst != NULL) { - if (kd->vmst->PTD != NULL) - free(kd->vmst->PTD); + free(kd->vmst->PTD); free(kd->vmst); kd->vmst = NULL; @@ -167,10 +166,8 @@ _kvm_initvtop(kvm_t *kd) return (0); invalid: - if (vm->PTD != NULL) { - free(vm->PTD); - vm->PTD = NULL; - } + free(vm->PTD); + vm->PTD = NULL; return (-1); } diff --git a/lib/libkvm/kvm_m88k.c b/lib/libkvm/kvm_m88k.c index 54e4239d4cf..0d5df390e41 100644 --- a/lib/libkvm/kvm_m88k.c +++ b/lib/libkvm/kvm_m88k.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm_m88k.c,v 1.5 2013/11/01 15:57:56 deraadt Exp $ */ +/* $OpenBSD: kvm_m88k.c,v 1.6 2015/12/19 18:40:30 mmcc Exp $ */ /* $NetBSD: kvm_alpha.c,v 1.2 1995/09/29 03:57:48 cgd Exp $ */ /* @@ -46,10 +46,8 @@ void _kvm_freevtop(kvm_t *kd) { - if (kd->vmst != NULL) { - free(kd->vmst); - kd->vmst = NULL; - } + free(kd->vmst); + kd->vmst = NULL; } int diff --git a/lib/libkvm/kvm_powerpc.c b/lib/libkvm/kvm_powerpc.c index f469bec6775..7bfc421651c 100644 --- a/lib/libkvm/kvm_powerpc.c +++ b/lib/libkvm/kvm_powerpc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm_powerpc.c,v 1.9 2014/11/18 20:51:00 krw Exp $ */ +/* $OpenBSD: kvm_powerpc.c,v 1.10 2015/12/19 18:40:30 mmcc Exp $ */ /*- * Copyright (C) 1996 Wolfgang Solfrank. @@ -56,10 +56,8 @@ void _kvm_freevtop(kvm_t *kd) { - if (kd->vmst != NULL) { - free(kd->vmst); - kd->vmst = NULL; - } + free(kd->vmst); + kd->vmst = NULL; } /*ARGSUSED*/ |