Fix: cli: increment bt_value_null ref count when returning null value
[babeltrace.git] / src / cli / babeltrace2-cfg-cli-params-arg.c
index d69ee8225ce3d69aad2c4c200fb9c41bd564a410..79cde92970a53d49d221fc9e100daf61c3abc941 100644 (file)
@@ -29,7 +29,6 @@
 #include <inttypes.h>
 #include <babeltrace2/babeltrace.h>
 #include "common/common.h"
-#include <popt.h>
 #include <glib.h>
 #include <sys/types.h>
 #include "babeltrace2-cfg.h"
@@ -87,7 +86,7 @@ void ini_append_error_expecting(struct ini_parsing_state *state,
        g_string_append_printf(state->ini_error, "Expecting %s:\n", expecting);
 
        /* Only append error if there's one line */
-       if (strchr(state->arg, '\n') != NULL || strlen(state->arg) == 0) {
+       if (strchr(state->arg, '\n') || strlen(state->arg) == 0) {
                return;
        }
 
@@ -321,6 +320,7 @@ bt_value *ini_parse_value(struct ini_parsing_state *state)
                if (strcmp(id, "null") == 0 || strcmp(id, "NULL") == 0 ||
                                strcmp(id, "nul") == 0) {
                        value = bt_value_null;
+                       bt_value_get_ref(value);
                } else if (strcmp(id, "true") == 0 || strcmp(id, "TRUE") == 0 ||
                                strcmp(id, "yes") == 0 ||
                                strcmp(id, "YES") == 0) {
This page took 0.024355 seconds and 4 git commands to generate.