genconf: fix crash in confnode token completion
authorOlivier Matz <zer0@droids-corp.org>
Fri, 18 Feb 2011 17:02:31 +0000 (18:02 +0100)
committerOlivier Matz <zer0@droids-corp.org>
Sun, 13 Mar 2011 10:09:24 +0000 (11:09 +0100)
Signed-off-by: Olivier Matz <zer0@droids-corp.org>
src/genconf/parse_confnode.c

index 21ccaac..f3dcda6 100644 (file)
@@ -199,6 +199,7 @@ complete_conf_node_start(cmdline_parse_token_hdr_t *tk, void **opaque)
        cb = malloc(sizeof(*cb));
        if (cb == NULL)
                return -1;
+       *opaque = cb;
 
        n = get_next_node(*tkd->cur, NULL, flags, mask);
        if (n == NULL)
@@ -206,7 +207,6 @@ complete_conf_node_start(cmdline_parse_token_hdr_t *tk, void **opaque)
 
        cb->start = *tkd->cur;
        cb->cur = n;
-       *opaque = cb;
        return 0;
 }