fix config str
authorOlivier Matz <zer0@droids-corp.org>
Thu, 21 Jun 2018 20:45:48 +0000 (22:45 +0200)
committerOlivier Matz <zer0@droids-corp.org>
Thu, 21 Jun 2018 20:45:48 +0000 (22:45 +0200)
lib/ecoli_node_str.c

index 28c69b9..0100fec 100644 (file)
@@ -108,7 +108,7 @@ static int ec_node_str_set_config(struct ec_node *gen_node,
        const struct ec_config *value = NULL;
        char *s = NULL;
 
        const struct ec_config *value = NULL;
        char *s = NULL;
 
-       value = ec_config_get(config, "string");
+       value = ec_config_dict_get(config, "string");
        if (value == NULL) {
                errno = EINVAL;
                goto fail;
        if (value == NULL) {
                errno = EINVAL;
                goto fail;
@@ -146,6 +146,7 @@ EC_NODE_TYPE_REGISTER(ec_node_str_type);
 int ec_node_str_set_str(struct ec_node *gen_node, const char *str)
 {
        struct ec_config *config = NULL;
 int ec_node_str_set_str(struct ec_node *gen_node, const char *str)
 {
        struct ec_config *config = NULL;
+       int ret;
 
        if (ec_node_check_type(gen_node, &ec_node_str_type) < 0)
                goto fail;
 
        if (ec_node_check_type(gen_node, &ec_node_str_type) < 0)
                goto fail;
@@ -159,10 +160,13 @@ int ec_node_str_set_str(struct ec_node *gen_node, const char *str)
        if (config == NULL)
                goto fail;
 
        if (config == NULL)
                goto fail;
 
-       if (ec_config_dict_set(config, "string", ec_config_string(str)) < 0)
+       ret = ec_config_dict_set(config, "string", ec_config_string(str));
+       if (ret < 0)
                goto fail;
 
                goto fail;
 
-       if (ec_node_set_config(gen_node, config) < 0)
+       ret = ec_node_set_config(gen_node, config);
+       config = NULL;
+       if (ret < 0)
                goto fail;
 
        return 0;
                goto fail;
 
        return 0;