[Decoder] Bugfix: get_property/tensorseg format error
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 25 Feb 2019 08:25:24 +0000 (17:25 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Tue, 26 Feb 2019 02:25:11 +0000 (11:25 +0900)
1. Do not print "," as the first character: write "seg1,seg2,seg3" instead of ",seg1,seg2,seg3".
2. Free memory!

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
gst/nnstreamer/tensor_split/gsttensorsplit.c

index 5df6942..3ae8b78 100644 (file)
@@ -645,7 +645,17 @@ gst_tensor_split_get_property (GObject * object, guint prop_id,
         strings = (gchar **) g_ptr_array_free (arr, FALSE);
         p = g_strjoinv (":", strings);
         g_free (strings);
-        strv = g_strjoin (",", strv, p, NULL);
+        if (i > 0) {
+          /** if i = 1, this is previous p.
+            * otherwise, it's previous g_strjoin result */
+          gchar *oldstrv = strv;
+
+          strv = g_strjoin (",", strv, p, NULL);
+          g_free (oldstrv);
+          g_free (p);
+        } else {
+          strv = p;
+        }
       }
       g_value_set_string (value, strv);
       break;