Fix coverity issues 73/153573/1 accepted/tizen/4.0/unified/20171011.071415 submit/tizen_4.0/20171010.100840 tizen_4.0.IoT.p1_release
authorGilbok Lee <gilbok.lee@samsung.com>
Fri, 29 Sep 2017 01:18:48 +0000 (10:18 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Fri, 29 Sep 2017 01:18:48 +0000 (10:18 +0900)
[Version] 0.1.24
[Profile] Mobile, Wearable, TV
[Issue Type] Fix coverity issues

Change-Id: I67cfb39f8904474b741e3a646274f71fb5fc8364

packaging/capi-mediademuxer.spec
src/port_gst/mediademuxer_port_gst.c

index 94b2671..cdd1708 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-mediademuxer
 Summary:    A Media Demuxer library in Tizen Native API
-Version:    0.1.23
+Version:    0.1.24
 Release:    1
 Group:      Multimedia/API
 License:    Apache-2.0
index 4076551..ae1adb7 100755 (executable)
@@ -699,6 +699,13 @@ static void __gst_on_pad_added(GstElement *element, GstPad *pad, gpointer data)
        }
        gst_caps_unref(caps);
        tmp = head_track->head;
+
+       if (!tmp) {
+               MD_I("trak is NULL\n");
+               MEDIADEMUXER_FLEAVE();
+               return;
+       }
+
        while (tmp->next)
                tmp = tmp->next;
        if (!tmp || !tmp->caps_string) {
@@ -1253,7 +1260,7 @@ int _set_mime_audio(media_format_h format, track *head)
        int bit = 0;
        int channels = 0;
        int id3_flag = 0;
-       const gchar *stream_format;
+       const gchar *stream_format = NULL;
        media_format_mimetype_e mime_type = MEDIA_FORMAT_MAX;
 
        struc = gst_caps_get_structure(head->caps, 0);
@@ -1274,10 +1281,12 @@ int _set_mime_audio(media_format_h format, track *head)
                                goto ERROR;
                        stream_format = gst_structure_get_string(struc, "stream-format");
 
-                       if (strncmp(stream_format, "adts", 4) == 0)
-                               media_format_set_audio_aac_type(format, 1);
-                       else
-                               media_format_set_audio_aac_type(format, 0);
+                       if (stream_format) {
+                               if (strncmp(stream_format, "adts", 4) == 0)
+                                       media_format_set_audio_aac_type(format, 1);
+                               else
+                                       media_format_set_audio_aac_type(format, 0);
+                       }
 
                } else if (mpegversion == 1 || id3_flag) {
                        gst_structure_get_int(struc, "layer", &layer);