From 28a437da50d2b13345eab4b36c7305b94ec4e008 Mon Sep 17 00:00:00 2001 From: jsg Date: Sat, 18 Apr 2015 09:32:59 +0000 Subject: [PATCH] Avoid calling freeifaddrs() with an uninitialised pointer in an error path. --- usr.bin/systat/mbufs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/usr.bin/systat/mbufs.c b/usr.bin/systat/mbufs.c index 723cac82552..e58889c7ae5 100644 --- a/usr.bin/systat/mbufs.c +++ b/usr.bin/systat/mbufs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mbufs.c,v 1.39 2015/01/20 18:26:57 deraadt Exp $ */ +/* $OpenBSD: mbufs.c,v 1.40 2015/04/18 09:32:59 jsg Exp $ */ /* * Copyright (c) 2008 Can Erkin Acar * @@ -204,7 +204,7 @@ int read_mb(void) { struct kinfo_pool pool; - struct ifaddrs *ifap, *ifa; + struct ifaddrs *ifap = NULL, *ifa; struct if_info *ifi; struct if_rxring_info *ifr; int mib[4]; @@ -344,7 +344,8 @@ read_mb(void) } exit: - freeifaddrs(ifap); + if (ifap) + freeifaddrs(ifap); return (ret); } -- 2.20.1