From: Haihao Xiang Date: Wed, 9 Jan 2019 00:58:00 +0000 (+0800) Subject: msdk: release resources if failing to create the buffer pool X-Git-Tag: 1.19.3~507^2~3643 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ba7f4de2986ac364fe8ea6484a453ce066bf6843;p=platform%2Fupstream%2Fgstreamer.git msdk: release resources if failing to create the buffer pool Needn't check the pointers against NULL because the pointers are non-NULL --- diff --git a/sys/msdk/gstmsdkdec.c b/sys/msdk/gstmsdkdec.c index 016122d..5d80ca4 100644 --- a/sys/msdk/gstmsdkdec.c +++ b/sys/msdk/gstmsdkdec.c @@ -1112,11 +1112,14 @@ error_no_pool: error_no_allocator: { GST_INFO_OBJECT (thiz, "failed to create allocator"); + gst_object_unref (pool); return NULL; } error_pool_config: { GST_INFO_OBJECT (thiz, "failed to set config"); + gst_object_unref (pool); + gst_object_unref (allocator); return NULL; } } diff --git a/sys/msdk/gstmsdkenc.c b/sys/msdk/gstmsdkenc.c index c3e16ce..6f90249 100644 --- a/sys/msdk/gstmsdkenc.c +++ b/sys/msdk/gstmsdkenc.c @@ -952,11 +952,14 @@ error_no_pool: error_no_allocator: { GST_INFO_OBJECT (thiz, "failed to create allocator"); + gst_object_unref (pool); return FALSE; } error_pool_config: { GST_INFO_OBJECT (thiz, "failed to set config"); + gst_object_unref (pool); + gst_object_unref (allocator); return FALSE; } } diff --git a/sys/msdk/gstmsdkvpp.c b/sys/msdk/gstmsdkvpp.c index d769d40..027037b 100644 --- a/sys/msdk/gstmsdkvpp.c +++ b/sys/msdk/gstmsdkvpp.c @@ -304,22 +304,20 @@ error_no_pool: error_no_video_info: { GST_INFO_OBJECT (thiz, "Failed to get Video info from caps"); + gst_object_unref (pool); return NULL; } error_no_allocator: { GST_INFO_OBJECT (thiz, "Failed to create allocator"); - if (pool) - gst_object_unref (pool); + gst_object_unref (pool); return NULL; } error_pool_config: { GST_INFO_OBJECT (thiz, "Failed to set config"); - if (pool) - gst_object_unref (pool); - if (allocator) - gst_object_unref (allocator); + gst_object_unref (pool); + gst_object_unref (allocator); return NULL; } }