]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Fix segfault on lxc-create when no template specified
authorKATOH Yasufumi <karma@jazz.email.ne.jp>
Wed, 23 Oct 2013 12:00:53 +0000 (21:00 +0900)
committerStéphane Graber <stgraber@ubuntu.com>
Wed, 23 Oct 2013 23:27:05 +0000 (19:27 -0400)
When no template file is specified on lxc-create, recieve segfault.
So change not to append header in config when no template is specified.

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/lxccontainer.c

index c8ecef3b2dc57ff10279a6ad50eb25d61ed31934..6e6c38ce642b3fc22bbf4d4da47d9357c802c112 100644 (file)
@@ -1089,9 +1089,11 @@ static bool lxcapi_create(struct lxc_container *c, const char *t,
                lxc_conf_free(c->lxc_conf);
        c->lxc_conf = NULL;
 
-       if (!prepend_lxc_header(c->configfile, tpath, argv)) {
-               ERROR("Error prepending header to configuration file");
-               goto out_unlock;
+       if (t) {
+               if (!prepend_lxc_header(c->configfile, tpath, argv)) {
+                       ERROR("Error prepending header to configuration file");
+                       goto out_unlock;
+               }
        }
        bret = load_config_locked(c, c->configfile);