From: Hyunsoo Park Date: Tue, 6 Jul 2021 09:18:01 +0000 (+0900) Subject: Fix Coverity issue X-Git-Tag: accepted/tizen/6.5/unified/20211028.123843^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fmultimedia%2Flibmm-streamrecorder.git;a=commitdiff_plain;h=3f1fd35eefb28006523c41e0438785e30386afa1 Fix Coverity issue Change-Id: I16df6ee24bff0454db0f06a28a5c640a20e1bd0e Signed-off-by: Hyunsoo Park --- diff --git a/packaging/libmm-streamrecorder.spec b/packaging/libmm-streamrecorder.spec index 3c0dc89..857a356 100644 --- a/packaging/libmm-streamrecorder.spec +++ b/packaging/libmm-streamrecorder.spec @@ -1,6 +1,6 @@ Name: libmm-streamrecorder Summary: Media Stream Recorder library -Version: 0.0.35 +Version: 0.0.36 Release: 0 Group: Multimedia/Other License: Apache-2.0 diff --git a/src/mm_streamrecorder_util.c b/src/mm_streamrecorder_util.c index 6666ed5..dd2a782 100644 --- a/src/mm_streamrecorder_util.c +++ b/src/mm_streamrecorder_util.c @@ -130,7 +130,7 @@ int _mmstreamrecorder_get_pixel_format(GstCaps *caps) { const GstStructure *structure; const char *media_type = NULL; - MMPixelFormatType type = 0; + MMPixelFormatType type = MM_PIXEL_FORMAT_INVALID; unsigned int fourcc = 0; GstVideoInfo media_info; @@ -150,9 +150,12 @@ int _mmstreamrecorder_get_pixel_format(GstCaps *caps) } else if (!strcmp(media_type, "video/x-raw-yuv")) { _mmstreamrec_dbg_log("It is yuv."); gst_video_info_init(&media_info); - gst_video_info_from_caps(&media_info, caps); - fourcc = gst_video_format_to_fourcc(GST_VIDEO_INFO_FORMAT(&media_info)); - type = _mmstreamrecorder_get_pixtype(fourcc); + if (gst_video_info_from_caps(&media_info, caps)) { + fourcc = gst_video_format_to_fourcc(GST_VIDEO_INFO_FORMAT(&media_info)); + type = _mmstreamrecorder_get_pixtype(fourcc); + } else { + _mmstreamrec_dbg_err("Getting media_info is failed"); + } } else if (!strcmp(media_type, "video/x-raw-rgb")) { _mmstreamrec_dbg_log("It is rgb."); type = MM_PIXEL_FORMAT_RGB888; @@ -163,6 +166,7 @@ int _mmstreamrecorder_get_pixel_format(GstCaps *caps) _mmstreamrec_dbg_log("Type [%d]", type); +error: gst_caps_unref(caps); caps = NULL;