mirror of https://github.com/F-Stack/f-stack.git
Fix a crash bug while use `ff_ifconfig` to get interface list of bridge.
This commit is contained in:
parent
f654b818fc
commit
9afeb6b147
|
@ -58,6 +58,7 @@ static const char rcsid[] =
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <rte_malloc.h>
|
||||||
|
|
||||||
#include "ifconfig.h"
|
#include "ifconfig.h"
|
||||||
|
|
||||||
|
@ -166,7 +167,11 @@ bridge_interfaces(int s, const char *prefix)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
#ifndef FSTACK
|
||||||
ninbuf = realloc(inbuf, len);
|
ninbuf = realloc(inbuf, len);
|
||||||
|
#else
|
||||||
|
ninbuf = rte_malloc(NULL, len, 0);
|
||||||
|
#endif
|
||||||
if (ninbuf == NULL)
|
if (ninbuf == NULL)
|
||||||
err(1, "unable to allocate interface buffer");
|
err(1, "unable to allocate interface buffer");
|
||||||
bifc.ifbic_len = len;
|
bifc.ifbic_len = len;
|
||||||
|
@ -212,7 +217,11 @@ bridge_interfaces(int s, const char *prefix)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef FSTACK
|
||||||
free(inbuf);
|
free(inbuf);
|
||||||
|
#else
|
||||||
|
rte_free(inbuf);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue