[vlc-commits] [Git][videolan/vlc][master] codec: vpx_alpha: fix memory leak on format

Steve Lhomme (@robUx4) gitlab at videolan.org
Mon Sep 9 09:49:26 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
949a1d32 by Alexandre Janniaux at 2024-09-09T09:34:15+00:00
codec: vpx_alpha: fix memory leak on format

The es_format_t instances are copying allocations like languages that
were not released for the internal decoders and the input format.

Leaks information:

    STACK OF 1 INSTANCE OF 'ROOT LEAK: <malloc in es_format_Copy>':
    22  libsystem_pthread.dylib               0x185e89d34 thread_start + 8
    21  libsystem_pthread.dylib               0x185e8ef94 _pthread_start + 136
    20  libvlccore.9.dylib                    0x10302c1e4 Run + 72  input.c:418
    19  libvlccore.9.dylib                    0x10302e2d4 Init + 4620  input.c:1354
    18  libvlccore.9.dylib                    0x103032704 es_out_PrivControl + 68  es_out.h:133
    17  libvlccore.9.dylib                    0x10302a1f4 PrivControl + 864  es_out_timeshift.c:828
    16  libvlccore.9.dylib                    0x10302aec0 CmdExecutePrivControl + 216  es_out_timeshift.c:1903
    15  libvlccore.9.dylib                    0x10302af10 es_out_in_PrivControl + 60  es_out_timeshift.c:489
    14  libvlccore.9.dylib                    0x1030212a0 EsOutPrivControl + 76  es_out.c:3998
    13  libvlccore.9.dylib                    0x103021900 EsOutVaPrivControlLocked + 392  es_out.c:0
    12  libvlccore.9.dylib                    0x1030230b4 EsOutSelect + 456  es_out.c:0
    11  libvlccore.9.dylib                    0x103023f64 EsOutSelectEs + 212  es_out.c:2462
    10  libvlccore.9.dylib                    0x10302352c EsOutCreateDecoder + 364  es_out.c:0
    9   libvlccore.9.dylib                    0x10301a854 decoder_New + 604  decoder.c:2207
    8   libvlccore.9.dylib                    0x10301c828 LoadDecoder + 200  decoder.c:0
    7   libvlccore.9.dylib                    0x1030078d0 module_need + 56  modules.c:272
    6   libvlccore.9.dylib                    0x1030077a4 vlc_module_load + 272  modules.c:233
    5   libvlccore.9.dylib                    0x10300797c generic_start + 68  modules.c:261
    4   ???                                   0x109b2151c 0x7fffffffffffffff + 9223372041312408861
    3   libvlccore.9.dylib                    0x10301f154 decoder_Init + 76  decoder_helpers.c:50
    2   libvlccore.9.dylib                    0x10306d214 es_format_Copy + 112  es_format.c:336
    1   libsystem_c.dylib                     0x185d26a64 strdup + 40
    0   libsystem_malloc.dylib                0x185cc8a68 _malloc_zone_malloc_instrumented_or_legacy + 148 
    ====
        1 (16 bytes) ROOT LEAK: <malloc in es_format_Copy 0x12008a0f0> [16]

    STACK OF 1 INSTANCE OF 'ROOT LEAK: <malloc in es_format_Copy>':
    22  libsystem_pthread.dylib               0x185e89d34 thread_start + 8
    21  libsystem_pthread.dylib               0x185e8ef94 _pthread_start + 136
    20  libvlccore.9.dylib                    0x10302c1e4 Run + 72  input.c:418
    19  libvlccore.9.dylib                    0x10302e2d4 Init + 4620  input.c:1354
    18  libvlccore.9.dylib                    0x103032704 es_out_PrivControl + 68  es_out.h:133
    17  libvlccore.9.dylib                    0x10302a1f4 PrivControl + 864  es_out_timeshift.c:828
    16  libvlccore.9.dylib                    0x10302aec0 CmdExecutePrivControl + 216  es_out_timeshift.c:1903
    15  libvlccore.9.dylib                    0x10302af10 es_out_in_PrivControl + 60  es_out_timeshift.c:489
    14  libvlccore.9.dylib                    0x1030212a0 EsOutPrivControl + 76  es_out.c:3998
    13  libvlccore.9.dylib                    0x103021900 EsOutVaPrivControlLocked + 392  es_out.c:0
    12  libvlccore.9.dylib                    0x1030230b4 EsOutSelect + 456  es_out.c:0
    11  libvlccore.9.dylib                    0x103023f64 EsOutSelectEs + 212  es_out.c:2462
    10  libvlccore.9.dylib                    0x10302352c EsOutCreateDecoder + 364  es_out.c:0
    9   libvlccore.9.dylib                    0x10301a854 decoder_New + 604  decoder.c:2207
    8   libvlccore.9.dylib                    0x10301c828 LoadDecoder + 200  decoder.c:0
    7   libvlccore.9.dylib                    0x1030078d0 module_need + 56  modules.c:272
    6   libvlccore.9.dylib                    0x1030077a4 vlc_module_load + 272  modules.c:233
    5   libvlccore.9.dylib                    0x10300797c generic_start + 68  modules.c:261
    4   ???                                   0x109b2151c 0x7fffffffffffffff + 9223372041312408861
    3   libvlccore.9.dylib                    0x10301f154 decoder_Init + 76  decoder_helpers.c:50
    2   libvlccore.9.dylib                    0x10306d214 es_format_Copy + 112  es_format.c:336
    1   libsystem_c.dylib                     0x185d26a64 strdup + 40
    0   libsystem_malloc.dylib                0x185cc8a68 _malloc_zone_malloc_instrumented_or_legacy + 148 
    ====
        1 (16 bytes) ROOT LEAK: <malloc in es_format_Copy 0x10f0f9eb0> [16]

    STACK OF 1 INSTANCE OF 'ROOT LEAK: <malloc in es_format_Copy>':
    22  libsystem_pthread.dylib               0x185e89d34 thread_start + 8
    21  libsystem_pthread.dylib               0x185e8ef94 _pthread_start + 136
    20  libvlccore.9.dylib                    0x10302c1e4 Run + 72  input.c:418
    19  libvlccore.9.dylib                    0x10302e2d4 Init + 4620  input.c:1354
    18  libvlccore.9.dylib                    0x103032704 es_out_PrivControl + 68  es_out.h:133
    17  libvlccore.9.dylib                    0x10302a1f4 PrivControl + 864  es_out_timeshift.c:828
    16  libvlccore.9.dylib                    0x10302aec0 CmdExecutePrivControl + 216  es_out_timeshift.c:1903
    15  libvlccore.9.dylib                    0x10302af10 es_out_in_PrivControl + 60  es_out_timeshift.c:489
    14  libvlccore.9.dylib                    0x1030212a0 EsOutPrivControl + 76  es_out.c:3998
    13  libvlccore.9.dylib                    0x103021900 EsOutVaPrivControlLocked + 392  es_out.c:0
    12  libvlccore.9.dylib                    0x1030230b4 EsOutSelect + 456  es_out.c:0
    11  libvlccore.9.dylib                    0x103023f64 EsOutSelectEs + 212  es_out.c:2462
    10  libvlccore.9.dylib                    0x10302352c EsOutCreateDecoder + 364  es_out.c:0
    9   libvlccore.9.dylib                    0x10301a854 decoder_New + 604  decoder.c:2207
    8   libvlccore.9.dylib                    0x10301c828 LoadDecoder + 200  decoder.c:0
    7   libvlccore.9.dylib                    0x1030078d0 module_need + 56  modules.c:272
    6   libvlccore.9.dylib                    0x1030077a4 vlc_module_load + 272  modules.c:233
    5   libvlccore.9.dylib                    0x10300797c generic_start + 68  modules.c:261
    4   ???                                   0x109b214d8 0x7fffffffffffffff + 9223372041312408793
    3   libvlccore.9.dylib                    0x10301f154 decoder_Init + 76  decoder_helpers.c:50
    2   libvlccore.9.dylib                    0x10306d214 es_format_Copy + 112  es_format.c:336
    1   libsystem_c.dylib                     0x185d26a64 strdup + 40
    0   libsystem_malloc.dylib                0x185cc8a68 _malloc_zone_malloc_instrumented_or_legacy + 148 
    ====
        1 (16 bytes) ROOT LEAK: <malloc in es_format_Copy 0x120089de0> [16]

    STACK OF 1 INSTANCE OF 'ROOT LEAK: <malloc in es_format_Copy>':
    21  libsystem_pthread.dylib               0x185e89d34 thread_start + 8
    20  libsystem_pthread.dylib               0x185e8ef94 _pthread_start + 136
    19  libvlccore.9.dylib                    0x10302c1e4 Run + 72  input.c:418
    18  libvlccore.9.dylib                    0x10302e2d4 Init + 4620  input.c:1354
    17  libvlccore.9.dylib                    0x103032704 es_out_PrivControl + 68  es_out.h:133
    16  libvlccore.9.dylib                    0x10302a1f4 PrivControl + 864  es_out_timeshift.c:828
    15  libvlccore.9.dylib                    0x10302aec0 CmdExecutePrivControl + 216  es_out_timeshift.c:1903
    14  libvlccore.9.dylib                    0x10302af10 es_out_in_PrivControl + 60  es_out_timeshift.c:489
    13  libvlccore.9.dylib                    0x1030212a0 EsOutPrivControl + 76  es_out.c:3998
    12  libvlccore.9.dylib                    0x103021900 EsOutVaPrivControlLocked + 392  es_out.c:0
    11  libvlccore.9.dylib                    0x1030230b4 EsOutSelect + 456  es_out.c:0
    10  libvlccore.9.dylib                    0x103023f64 EsOutSelectEs + 212  es_out.c:2462
    9   libvlccore.9.dylib                    0x10302352c EsOutCreateDecoder + 364  es_out.c:0
    8   libvlccore.9.dylib                    0x10301a854 decoder_New + 604  decoder.c:2207
    7   libvlccore.9.dylib                    0x10301c828 LoadDecoder + 200  decoder.c:0
    6   libvlccore.9.dylib                    0x1030078d0 module_need + 56  modules.c:272
    5   libvlccore.9.dylib                    0x1030077a4 vlc_module_load + 272  modules.c:233
    4   libvlccore.9.dylib                    0x10300797c generic_start + 68  modules.c:261
    3   ???                                   0x109b214a4 0x7fffffffffffffff + 9223372041312408741
    2   libvlccore.9.dylib                    0x10306d214 es_format_Copy + 112  es_format.c:336
    1   libsystem_c.dylib                     0x185d26a64 strdup + 40
    0   libsystem_malloc.dylib                0x185cc8a68 _malloc_zone_malloc_instrumented_or_legacy + 148 
    ====
        1 (16 bytes) ROOT LEAK: <malloc in es_format_Copy 0x120088240> [16]

    STACK OF 1 INSTANCE OF 'ROOT LEAK: <malloc in es_format_Copy>':
    22  libsystem_pthread.dylib               0x185e89d34 thread_start + 8
    21  libsystem_pthread.dylib               0x185e8ef94 _pthread_start + 136
    20  libvlccore.9.dylib                    0x10302c1e4 Run + 72  input.c:418
    19  libvlccore.9.dylib                    0x10302e2d4 Init + 4620  input.c:1354
    18  libvlccore.9.dylib                    0x103032704 es_out_PrivControl + 68  es_out.h:133
    17  libvlccore.9.dylib                    0x10302a1f4 PrivControl + 864  es_out_timeshift.c:828
    16  libvlccore.9.dylib                    0x10302aec0 CmdExecutePrivControl + 216  es_out_timeshift.c:1903
    15  libvlccore.9.dylib                    0x10302af10 es_out_in_PrivControl + 60  es_out_timeshift.c:489
    14  libvlccore.9.dylib                    0x1030212a0 EsOutPrivControl + 76  es_out.c:3998
    13  libvlccore.9.dylib                    0x103021900 EsOutVaPrivControlLocked 
- - - - -


1 changed file:

- modules/codec/vpx_alpha.c


Changes:

=====================================
modules/codec/vpx_alpha.c
=====================================
@@ -601,6 +601,8 @@ int OpenDecoder(vlc_object_t *o)
     vlc_picture_chain_Init(&p_sys->alpha->decoded);
     es_format_Init(&p_sys->alpha->fmt_out, VIDEO_ES, 0);
 
+    es_format_Clean(&fmt);
+
     vlc_mutex_init(&p_sys->lock);
     vlc_vector_init(&p_sys->missing_alpha);
     dec->p_sys = p_sys;
@@ -648,8 +650,10 @@ void CloseDecoder(vlc_object_t *o)
     vpx_alpha *p_sys = dec->p_sys;
 
     es_format_Clean(&p_sys->opaque->fmt_out);
+    es_format_Clean(&p_sys->opaque->fmt_in);
     decoder_Destroy(&p_sys->opaque->dec);
     es_format_Clean(&p_sys->alpha->fmt_out);
+    es_format_Clean(&p_sys->alpha->fmt_in);
     decoder_Destroy(&p_sys->alpha->dec);
 
     if (p_sys->pool)



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/949a1d32769437fa434adf4287266110a71a9d9d

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/949a1d32769437fa434adf4287266110a71a9d9d
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list