X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Finterface.c;h=d05dd72309f80ffd79c6e94fbe2c9509d962afce;hb=db35efb33e81d0a013e09a8a6ffa362ad5962f7c;hp=caaad47a4acc8e03902e93277b67dfe52c0f1df2;hpb=b13246861a25336f8f645752fe111a9a82e470f1;p=collectd.git diff --git a/src/interface.c b/src/interface.c index caaad47a..d05dd723 100644 --- a/src/interface.c +++ b/src/interface.c @@ -190,7 +190,7 @@ static int interface_read (void) struct ifaddrs *if_list; struct ifaddrs *if_ptr; -/* Darin/Mac OS X and possible other *BSDs */ +/* Darwin/Mac OS X and possible other *BSDs */ #if HAVE_STRUCT_IF_DATA # define IFA_DATA if_data # define IFA_RX_BYTES ifi_ibytes @@ -368,9 +368,8 @@ static int interface_read (void) if (pnif != nif || ifstat == NULL) { - if (ifstat != NULL) - free(ifstat); - ifstat = malloc(nif * sizeof(perfstat_netinterface_t)); + free(ifstat); + ifstat = malloc(nif * sizeof (*ifstat)); } pnif = nif;