Handle empty strings in the notif-iter btr_string callbacks
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 15 Nov 2016 17:31:30 +0000 (12:31 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 27 May 2017 18:09:06 +0000 (14:09 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
plugins/ctf/common/notif-iter/notif-iter.c

index f29b72eeee7f5ad87e968549f131b1705be70990..5e06362613c1e6f5500322ef4ecb5026291afc0d 100644 (file)
@@ -1370,6 +1370,18 @@ enum bt_ctf_btr_status btr_string_begin_cb(
                goto end;
        }
 
+       /*
+        * Initialize string field payload to an empty string since in the
+        * case of a length 0 string the btr_string_cb won't be called and
+        * we will end up with an unset string payload.
+        */
+       ret = bt_ctf_field_string_set_value(field, "");
+       if (ret) {
+               PERR("Failed to initialize string field\n");
+               status = BT_CTF_BTR_STATUS_ERROR;
+               goto end;
+       }
+
 end:
        BT_PUT(field);
 
This page took 0.026893 seconds and 4 git commands to generate.