[FFmpeg-cvslog] wav: init st to NULL to avoid a false-positive warning.

Clément Bœsch git at videolan.org
Mon Jul 23 21:55:24 CEST 2012


ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Thu Sep  1 20:06:05 2011 +0200| [61884b9d1b6be16dbbfae6700cf8628e037ea28b] | committer: Derek Buitenhuis

wav: init st to NULL to avoid a false-positive warning.

If st is NULL, it means no 'fmt ' tag is found, but 'data' tag (which
needs a previous 'fmt ' tag to be parsed correctly and st initialized)
check will make sure st is never dereferenced in that case.

Fixes warning:
    libavformat/wav.c: In function ‘wav_read_header’:
    libavformat/wav.c:499:44: warning: ‘st’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=61884b9d1b6be16dbbfae6700cf8628e037ea28b
---

 libavformat/wav.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/wav.c b/libavformat/wav.c
index c01121f..1bfe6d5 100644
--- a/libavformat/wav.c
+++ b/libavformat/wav.c
@@ -387,7 +387,7 @@ static int wav_read_header(AVFormatContext *s)
     int rf64;
     uint32_t tag, list_type;
     AVIOContext *pb = s->pb;
-    AVStream *st;
+    AVStream *st = NULL;
     WAVContext *wav = s->priv_data;
     int ret, got_fmt = 0;
     int64_t next_tag_ofs, data_ofs = -1;



More information about the ffmpeg-cvslog mailing list