]> git.proxmox.com Git - mirror_lxc.git/commitdiff
network: remove stack allocations
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 5 Feb 2019 06:27:29 +0000 (07:27 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 6 Feb 2019 10:47:57 +0000 (11:47 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/network.c

index ec75b0c280ca02379e2d6199abde406a5e32ff0f..249d9d471f1e432ac37c7099b62d3cbbfc49b204 100644 (file)
@@ -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;