fix double free
authorOlivier Matz <zer0@droids-corp.org>
Thu, 29 Nov 2018 19:16:14 +0000 (20:16 +0100)
committerOlivier Matz <zer0@droids-corp.org>
Thu, 29 Nov 2018 19:16:54 +0000 (20:16 +0100)
libecoli_yaml/ecoli_yaml.c

index 76592e2..84007d5 100644 (file)
@@ -217,6 +217,7 @@ parse_ec_config(struct enode_table *table,
                if (enode == NULL)
                        goto fail;
                config = ec_config_node(enode);
                if (enode == NULL)
                        goto fail;
                config = ec_config_node(enode);
+               enode = NULL;
                if (config == NULL) {
                        fprintf(stderr, "Failed to create config\n");
                        goto fail;
                if (config == NULL) {
                        fprintf(stderr, "Failed to create config\n");
                        goto fail;
@@ -450,9 +451,11 @@ parse_ec_node(struct enode_table *table,
                goto fail;
 
        if (ec_node_set_config(enode, config) < 0) {
                goto fail;
 
        if (ec_node_set_config(enode, config) < 0) {
+               config = NULL; /* freed */
                fprintf(stderr, "Failed to set config\n");
                goto fail;
        }
                fprintf(stderr, "Failed to set config\n");
                goto fail;
        }
+       config = NULL; /* freed */
 
        if (help != NULL) {
                if (ec_keyval_set(ec_node_attrs(enode), "help", help,
 
        if (help != NULL) {
                if (ec_keyval_set(ec_node_attrs(enode), "help", help,