From: Christian Brauner Date: Tue, 5 Feb 2019 06:27:29 +0000 (+0100) Subject: network: remove stack allocations X-Git-Tag: lxc-3.2.0~164^2~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=95ea3d1fa0981d02007920dfe13657ac75e787e7;p=thirdparty%2Flxc.git network: remove stack allocations Signed-off-by: Christian Brauner --- diff --git a/src/lxc/network.c b/src/lxc/network.c index ec75b0c28..249d9d471 100644 --- a/src/lxc/network.c +++ b/src/lxc/network.c @@ -54,6 +54,7 @@ #include "file_utils.h" #include "log.h" #include "macro.h" +#include "memory_utils.h" #include "network.h" #include "nl.h" #include "raw_syscalls.h" @@ -549,15 +550,15 @@ out: #define PHYSNAME "/sys/class/net/%s/phy80211/name" static char *is_wlan(const char *ifname) { + __do_free char *path; int i, ret; long physlen; size_t len; - char *path; FILE *f; char *physname = NULL; len = strlen(ifname) + strlen(PHYSNAME) - 1; - path = alloca(len + 1); + path = must_realloc(NULL, len + 1); ret = snprintf(path, len, PHYSNAME, ifname); if (ret < 0 || (size_t)ret >= len) goto bad;