]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
conf: auto free run_buffer
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 19 Feb 2019 22:41:48 +0000 (23:41 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 19 Feb 2019 22:41:48 +0000 (23:41 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/conf.c

index cb5730af6588ed8d1f5e154d978ddcc7deb86627..bdd3a9f4f6fea837f532000092f986ab27ada085 100644 (file)
@@ -306,8 +306,8 @@ static struct limit_opt limit_opt[] = {
 
 static int run_buffer(char *buffer)
 {
+       __do_free char *output = NULL;
        int ret;
-       char *output;
        struct lxc_popen_FILE *f;
 
        f = lxc_popen(buffer);
@@ -326,8 +326,6 @@ static int run_buffer(char *buffer)
        while (fgets(output, LXC_LOG_BUFFER_SIZE, f->f))
                DEBUG("Script %s with output: %s", buffer, output);
 
-       free(output);
-
        ret = lxc_pclose(f);
        if (ret == -1) {
                SYSERROR("Script exited with error");