Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2018-02-15 02:56:21 +0300
committerJames Almer <jamrial@gmail.com>2018-02-15 02:56:51 +0300
commitaa6280805e21e1e2c3fb7bb1efb47a27ceeb3fed (patch)
tree9882e2b2085b45251024fdbb12b47e031884f933 /libavformat/aviobuf.c
parent23e1bf6e51106f54ab75551ccc98361b83ba55fe (diff)
avformat/aviobuf: zero initialize the AVIOContext in ffio_init_context()
This makes sure no field is ever used uninitialized. Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com> Reviewed-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/aviobuf.c')
-rw-r--r--libavformat/aviobuf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 86eb6579f4..d63db3897f 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -87,6 +87,8 @@ int ffio_init_context(AVIOContext *s,
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
int64_t (*seek)(void *opaque, int64_t offset, int whence))
{
+ memset(s, 0, sizeof(AVIOContext));
+
s->buffer = buffer;
s->orig_buffer_size =
s->buffer_size = buffer_size;
@@ -135,7 +137,7 @@ AVIOContext *avio_alloc_context(
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
int64_t (*seek)(void *opaque, int64_t offset, int whence))
{
- AVIOContext *s = av_mallocz(sizeof(AVIOContext));
+ AVIOContext *s = av_malloc(sizeof(AVIOContext));
if (!s)
return NULL;
ffio_init_context(s, buffer, buffer_size, write_flag, opaque,