[vlc-devel] [PATCH] flac: init flac_header_info.i_pts before usage

Alexandre Janniaux ajanni at videolabs.io
Wed Mar 25 17:15:31 CET 2020


Depending on FLAC_ParseSyncInfo results, the field might get
non-initialized but still assigned. Remove -Wmaybe-uninitialized warning
on Windows.
---
 modules/demux/flac.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/modules/demux/flac.c b/modules/demux/flac.c
index 92ad0178f9..8b1c118047 100644
--- a/modules/demux/flac.c
+++ b/modules/demux/flac.c
@@ -226,7 +226,7 @@ static block_t *GetPacketizedBlock( decoder_t *p_packetizer,
     {
         if( p_block->i_buffer >= FLAC_HEADER_SIZE_MAX )
         {
-            struct flac_header_info headerinfo;
+            struct flac_header_info headerinfo = { .i_pts = VLC_TICK_INVALID };
             int i_ret = FLAC_ParseSyncInfo( p_block->p_buffer, streaminfo, NULL, &headerinfo );
             assert( i_ret != 0 ); /* Same as packetizer */
             /* Use Frame PTS, not the interpolated one */
@@ -832,4 +832,3 @@ static void ParsePicture( demux_t *p_demux, const uint8_t *p_data, size_t i_data
 
     TAB_APPEND( p_sys->i_attachments, p_sys->attachments, p_attachment );
 }
-
-- 
2.26.0



More information about the vlc-devel mailing list