msdk: release resources if failing to create the buffer pool

Needn't check the pointers against NULL because the pointers are
non-NULL
This commit is contained in:
Haihao Xiang 2019-01-09 08:58:00 +08:00
parent a301150002
commit ba7f4de298
3 changed files with 10 additions and 6 deletions

View file

@ -1112,11 +1112,14 @@ error_no_pool:
error_no_allocator: error_no_allocator:
{ {
GST_INFO_OBJECT (thiz, "failed to create allocator"); GST_INFO_OBJECT (thiz, "failed to create allocator");
gst_object_unref (pool);
return NULL; return NULL;
} }
error_pool_config: error_pool_config:
{ {
GST_INFO_OBJECT (thiz, "failed to set config"); GST_INFO_OBJECT (thiz, "failed to set config");
gst_object_unref (pool);
gst_object_unref (allocator);
return NULL; return NULL;
} }
} }

View file

@ -952,11 +952,14 @@ error_no_pool:
error_no_allocator: error_no_allocator:
{ {
GST_INFO_OBJECT (thiz, "failed to create allocator"); GST_INFO_OBJECT (thiz, "failed to create allocator");
gst_object_unref (pool);
return FALSE; return FALSE;
} }
error_pool_config: error_pool_config:
{ {
GST_INFO_OBJECT (thiz, "failed to set config"); GST_INFO_OBJECT (thiz, "failed to set config");
gst_object_unref (pool);
gst_object_unref (allocator);
return FALSE; return FALSE;
} }
} }

View file

@ -304,22 +304,20 @@ error_no_pool:
error_no_video_info: error_no_video_info:
{ {
GST_INFO_OBJECT (thiz, "Failed to get Video info from caps"); GST_INFO_OBJECT (thiz, "Failed to get Video info from caps");
gst_object_unref (pool);
return NULL; return NULL;
} }
error_no_allocator: error_no_allocator:
{ {
GST_INFO_OBJECT (thiz, "Failed to create allocator"); GST_INFO_OBJECT (thiz, "Failed to create allocator");
if (pool) gst_object_unref (pool);
gst_object_unref (pool);
return NULL; return NULL;
} }
error_pool_config: error_pool_config:
{ {
GST_INFO_OBJECT (thiz, "Failed to set config"); GST_INFO_OBJECT (thiz, "Failed to set config");
if (pool) gst_object_unref (pool);
gst_object_unref (pool); gst_object_unref (allocator);
if (allocator)
gst_object_unref (allocator);
return NULL; return NULL;
} }
} }