Fix a crash bug while use `ff_ifconfig` to get interface list of bridge.

dev
fengbojiang(姜凤波) 2019-12-11 20:24:30 +08:00
parent 156135da39
commit 33d130f74c
1 changed files with 9 additions and 0 deletions

View File

@ -58,6 +58,7 @@ static const char rcsid[] =
#include <unistd.h>
#include <err.h>
#include <errno.h>
#include <rte_malloc.h>
#include "ifconfig.h"
@ -166,7 +167,11 @@ bridge_interfaces(int s, const char *prefix)
}
for (;;) {
#ifndef FSTACK
ninbuf = realloc(inbuf, len);
#else
ninbuf = rte_malloc(NULL, len, 0);
#endif
if (ninbuf == NULL)
err(1, "unable to allocate interface buffer");
bifc.ifbic_len = len;
@ -212,7 +217,11 @@ bridge_interfaces(int s, const char *prefix)
printf("\n");
}
#ifndef FSTACK
free(inbuf);
#else
rte_free(inbuf);
#endif
}
static void