[vlc-commits] [Git][videolan/vlc][master] speex: use calloc to allocate the block based init

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



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
58785ad2 by Steve Lhomme at 2026-09-20T08:59:33+02:00
speex: use calloc to allocate the block based init

p_header is free'd by speex_header_free() because it's also allocated by
speex_packet_to_header(). So to be coherent we should use the speex allocator.
But we can't as it's not public. We should do the equivalent which is a
calloc() and not a malloc().

speex_init_header() may not fill all the fields in the structure.

- - - - -


1 changed file:

- modules/codec/speex.c


Changes:

=====================================
modules/codec/speex.c
=====================================
@@ -786,7 +786,7 @@ static int DecodeRtpSpeexPacket( decoder_t *p_dec, block_t *p_speex_bit_block )
             return VLCDEC_SUCCESS;
         }
 
-        p_sys->p_header = malloc(sizeof(SpeexHeader));
+        p_sys->p_header = calloc(1, sizeof(SpeexHeader));
         if ( !p_sys->p_header )
         {
             msg_Err( p_dec, "Could not allocate a Speex header.");



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/58785ad23b35005b65e29dc96d2a8b68a24d0300

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/58785ad23b35005b65e29dc96d2a8b68a24d0300
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