[vlc-commits] [Git][videolan/vlc][master] 3 commits: glinterop_nvdec: use malloc/free for p_sys

Steve Lhomme (@robUx4) gitlab at videolan.org
Sun Sep 13 07:20:12 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
0546e82c by Abderhman Gamal at 2026-09-13T07:10:20+00:00
glinterop_nvdec: use malloc/free for p_sys

- - - - -
dd5a56ee by Abderhman Gamal at 2026-09-13T07:10:20+00:00
glinterop_nvdec: add a common error path

- - - - -
5314f4da by Abderhman Gamal at 2026-09-13T07:10:20+00:00
opengl interop: release the context on the error path

- - - - -


2 changed files:

- modules/hw/nvdec/nvdec_gl.c
- modules/video_output/opengl/interop.c


Changes:

=====================================
modules/hw/nvdec/nvdec_gl.c
=====================================
@@ -142,6 +142,7 @@ static void tc_nvdec_gl_close(struct vlc_gl_interop *interop)
 {
     converter_sys_t *p_sys = interop->priv;
     vlc_decoder_device_Release(p_sys->device);
+    free(p_sys);
 }
 
 static int Open(struct vlc_gl_interop *interop)
@@ -153,7 +154,7 @@ static int Open(struct vlc_gl_interop *interop)
     if (device == NULL || device->type != VLC_DECODER_DEVICE_NVDEC)
         return VLC_EGENERIC;
 
-    converter_sys_t *p_sys = vlc_obj_malloc(VLC_OBJECT(interop), sizeof(*p_sys));
+    converter_sys_t *p_sys = malloc(sizeof(*p_sys));
     if (unlikely(p_sys == NULL))
     {
         vlc_decoder_device_Release(device);
@@ -183,10 +184,7 @@ static int Open(struct vlc_gl_interop *interop)
     unsigned int device_count;
     result = CALL_CUDA(cuGLGetDevices, &device_count, &cuDecDevice, 1, CU_GL_DEVICE_LIST_ALL);
     if (result < 0)
-    {
-        vlc_decoder_device_Release(device);
-        return result;
-    }
+        goto error;
 
     CUdevice cuConverterDevice;
     CALL_CUDA(cuCtxPushCurrent, devsys->cuCtx);
@@ -197,10 +195,7 @@ static int Open(struct vlc_gl_interop *interop)
     {
         result = CALL_CUDA(cuCtxCreate, &p_sys->cuConverterCtx, 0, cuConverterDevice);
         if (result != VLC_SUCCESS)
-        {
-            vlc_decoder_device_Release(device);
-            return result;
-        }
+            goto error;
     }
 
     /* The pictures are uploaded upside-down */
@@ -210,8 +205,8 @@ static int Open(struct vlc_gl_interop *interop)
     const vlc_chroma_description_t *desc = vlc_fourcc_GetChromaDescription(render_chroma);
     if (desc == NULL)
     {
-        vlc_decoder_device_Release(device);
-        return VLC_EGENERIC;
+        result = VLC_EGENERIC;
+        goto error;
     }
     p_sys->pixel_size = desc->pixel_size;
     switch (render_chroma)
@@ -292,6 +287,14 @@ static int Open(struct vlc_gl_interop *interop)
     interop->priv = p_sys;
 
     return VLC_SUCCESS;
+
+error:
+    if (p_sys->cuConverterCtx)
+        CALL_CUDA(cuCtxDestroy, p_sys->cuConverterCtx);
+
+    free(p_sys);
+    vlc_decoder_device_Release(device);
+    return result;
 }
 
 vlc_module_begin ()


=====================================
modules/video_output/opengl/interop.c
=====================================
@@ -209,6 +209,8 @@ vlc_gl_interop_New(struct vlc_gl_t *gl, vlc_video_context *context,
     return interop;
 
 error:
+    if (interop->vctx)
+       vlc_video_context_Release(interop->vctx);
     vlc_object_delete(interop);
     return NULL;
 }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0a544554996ae900813ba92c70cd8c9408062497...5314f4dabc3c732e510bef39801be07b21fc4bd8

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0a544554996ae900813ba92c70cd8c9408062497...5314f4dabc3c732e510bef39801be07b21fc4bd8
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list