diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudacontext.c b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudacontext.c index aed158aa36..9b721736ca 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudacontext.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudacontext.c @@ -374,7 +374,8 @@ gst_cuda_context_finalize (GObject * object) * * Create #GstCudaContext with given device_id * - * Returns: a new #GstCudaContext or %NULL on failure + * Returns: (transfer full) (nullable): a new #GstCudaContext or %NULL on + * failure * * Since: 1.22 */ @@ -390,13 +391,16 @@ gst_cuda_context_new (guint device_id) } self = gst_cuda_context_new_wrapped (ctx, device_id); - if (!self) + if (!self) { + CuCtxDestroy (ctx); return NULL; + } self->priv->owns_context = TRUE; if (!gst_cuda_result (CuCtxPopCurrent (&old_ctx))) { GST_ERROR ("Could not pop current context"); + g_object_unref (self); return NULL; } @@ -522,7 +526,7 @@ gst_cuda_context_can_access_peer (GstCudaContext * ctx, GstCudaContext * peer) * represented by @handle and @device stay alive while the returned * #GstCudaContext is active. * - * Returns: (transfer full): A newly created #GstCudaContext + * Returns: (transfer full) (nullable): A newly created #GstCudaContext * * Since: 1.22 */ @@ -538,7 +542,7 @@ gst_cuda_context_new_wrapped (CUcontext handler, CUdevice device) g_return_val_if_fail (device >= 0, NULL); if (!init_cuda_ctx ()) - return FALSE; + return NULL; if (!gst_cuda_result (CuDeviceGetAttribute (&tex_align, CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT, device))) { diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.c b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.c index 9dfb0f7d4a..f4d5f5d002 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.c @@ -367,8 +367,7 @@ gst_cuda_handle_context_query (GstElement * element, * gst_context_new_cuda_context: * @cuda_ctx: (transfer none): a #GstCudaContext * - * Returns: (transfer full) (nullable): a new #GstContext embedding the @cuda_ctx - * or %NULL + * Returns: (transfer full): a new #GstContext embedding the @cuda_ctx * * Since: 1.22 */ @@ -571,7 +570,7 @@ gst_cuda_graphics_resource_unregister (GstCudaGraphicsResource * resource) * * Map previously registered resource with map flags * - * Returns: the `CUgraphicsResource` if successful or %NULL when failed + * Returns: (nullable): the `CUgraphicsResource` if successful or %NULL when failed * * Since: 1.22 */