From 33d130f74cefe466180161bdd86a2c864475f0ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?fengbojiang=28=E5=A7=9C=E5=87=A4=E6=B3=A2=29?= Date: Wed, 11 Dec 2019 20:24:30 +0800 Subject: [PATCH] Fix a crash bug while use `ff_ifconfig` to get interface list of bridge. --- tools/ifconfig/ifbridge.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/ifconfig/ifbridge.c b/tools/ifconfig/ifbridge.c index 4fb33282..9d5442a7 100644 --- a/tools/ifconfig/ifbridge.c +++ b/tools/ifconfig/ifbridge.c @@ -58,6 +58,7 @@ static const char rcsid[] = #include #include #include +#include #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