[FFmpeg-cvslog] Replace memset(0) by zero initializations.

Diego Biurrun git at videolan.org
Thu Mar 29 04:32:34 CEST 2012


ffmpeg | branch: master | Diego Biurrun <diego at biurrun.de> | Mon Jun  6 14:13:02 2011 +0200| [a92be9b856bd11b081041c43c25d442028fe9a63] | committer: Diego Biurrun

Replace memset(0) by zero initializations.

Also remove one pointless zero initialization in rangecoder.c.

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

 avplay.c                  |    3 +--
 avserver.c                |    9 +++------
 libavcodec/4xm.c          |    6 ++----
 libavcodec/aaccoder.c     |    3 +--
 libavcodec/aacpsy.c       |    6 ++----
 libavcodec/ac3dec.c       |    4 +---
 libavcodec/alsdec.c       |   11 +++--------
 libavcodec/bink.c         |    3 +--
 libavcodec/cook.c         |   20 ++++++--------------
 libavcodec/dvdsubdec.c    |    6 ++----
 libavcodec/dxva2.c        |    3 +--
 libavcodec/flac_parser.c  |    3 +--
 libavcodec/intrax8dsp.c   |    6 ++----
 libavcodec/jpeglsenc.c    |    3 +--
 libavcodec/libxvid_rc.c   |    9 +++------
 libavcodec/libxvidff.c    |   21 +++++++--------------
 libavcodec/mjpegdec.c     |    3 +--
 libavcodec/motion_est.c   |    3 +--
 libavcodec/mpegaudiodec.c |    7 ++-----
 libavcodec/ra144enc.c     |    3 +--
 libavcodec/rangecoder.c   |    2 +-
 libavcodec/rv34.c         |    5 +----
 libavcodec/smacker.c      |   11 +++--------
 libavcodec/tiff.c         |    3 +--
 libavcodec/truemotion1.c  |    3 +--
 libavcodec/wmaprodec.c    |    4 +---
 libavcodec/wmavoice.c     |    3 +--
 libavdevice/bktr.c        |    3 +--
 libavformat/asfcrypt.c    |    3 +--
 libavformat/movenc.c      |    3 +--
 libavformat/rtsp.c        |    9 +++------
 libavformat/sapenc.c      |    3 +--
 libavformat/sdp.c         |    6 ++----
 libavformat/seek-test.c   |    3 +--
 libavformat/tcp.c         |    3 +--
 libavformat/udp.c         |    3 +--
 libavformat/utils.c       |    3 +--
 libavutil/imgutils.c      |    4 +---
 libavutil/parseutils.c    |    4 +---
 39 files changed, 66 insertions(+), 144 deletions(-)

diff --git a/avplay.c b/avplay.c
index beb8dd1..d9c1786 100644
--- a/avplay.c
+++ b/avplay.c
@@ -1371,7 +1371,7 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts, int64_t
 
     /* if the frame is not skipped, then display it */
     if (vp->bmp) {
-        AVPicture pict;
+        AVPicture pict = { { 0 } };
 #if CONFIG_AVFILTER
         if (vp->picref)
             avfilter_unref_buffer(vp->picref);
@@ -1381,7 +1381,6 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts, int64_t
         /* get a pointer on the bitmap */
         SDL_LockYUVOverlay (vp->bmp);
 
-        memset(&pict, 0, sizeof(AVPicture));
         pict.data[0] = vp->bmp->pixels[0];
         pict.data[1] = vp->bmp->pixels[2];
         pict.data[2] = vp->bmp->pixels[1];
diff --git a/avserver.c b/avserver.c
index 4df8a3e..2b16932 100644
--- a/avserver.c
+++ b/avserver.c
@@ -335,8 +335,7 @@ static int resolve_host(struct in_addr *sin_addr, const char *hostname)
     if (!ff_inet_aton(hostname, sin_addr)) {
 #if HAVE_GETADDRINFO
         struct addrinfo *ai, *cur;
-        struct addrinfo hints;
-        memset(&hints, 0, sizeof(hints));
+        struct addrinfo hints = { 0 };
         hints.ai_family = AF_INET;
         if (getaddrinfo(hostname, NULL, &hints, &ai))
             return -1;
@@ -2822,7 +2821,7 @@ static int rtsp_parse_request(HTTPContext *c)
     char protocol[32];
     char line[1024];
     int len;
-    RTSPMessageHeader header1, *header = &header1;
+    RTSPMessageHeader header1 = { 0 }, *header = &header1;
 
     c->buffer_ptr[0] = '\0';
     p = c->buffer;
@@ -2848,7 +2847,6 @@ static int rtsp_parse_request(HTTPContext *c)
     }
 
     /* parse each header line */
-    memset(header, 0, sizeof(*header));
     /* skip to next line */
     while (*p != '\n' && *p != '\0')
         p++;
@@ -4647,7 +4645,7 @@ static const OptionDef options[] = {
 
 int main(int argc, char **argv)
 {
-    struct sigaction sigact;
+    struct sigaction sigact = { { 0 } };
 
     parse_loglevel(argc, argv, options);
     av_register_all();
@@ -4665,7 +4663,6 @@ int main(int argc, char **argv)
 
     av_lfg_init(&random_state, av_get_random_seed());
 
-    memset(&sigact, 0, sizeof(sigact));
     sigact.sa_handler = handle_child_exit;
     sigact.sa_flags = SA_NOCLDSTOP | SA_RESTART;
     sigaction(SIGCHLD, &sigact, 0);
diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c
index 139a642..8cc5592 100644
--- a/libavcodec/4xm.c
+++ b/libavcodec/4xm.c
@@ -552,7 +552,7 @@ static int decode_i_mb(FourXContext *f)
 static const uint8_t *read_huffman_tables(FourXContext *f,
                                           const uint8_t * const buf)
 {
-    int frequency[512];
+    int frequency[512] = { 0 };
     uint8_t flag[512];
     int up[512];
     uint8_t len_tab[257];
@@ -561,7 +561,6 @@ static const uint8_t *read_huffman_tables(FourXContext *f,
     const uint8_t *ptr = buf;
     int j;
 
-    memset(frequency, 0, sizeof(frequency));
     memset(up, -1, sizeof(up));
 
     start = *ptr++;
@@ -661,8 +660,7 @@ static int decode_i2_frame(FourXContext *f, const uint8_t *buf, int length)
 
     for (y = 0; y < height; y += 16) {
         for (x = 0; x < width; x += 16) {
-            unsigned int color[4], bits;
-            memset(color, 0, sizeof(color));
+            unsigned int color[4] = { 0 }, bits;
             // warning following is purely guessed ...
             color[0] = bytestream2_get_le16u(&g3);
             color[1] = bytestream2_get_le16u(&g3);
diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 72be2a2..36a49a7 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -714,7 +714,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
 {
     int start = 0, i, w, w2, g;
     int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels;
-    float dists[128], uplims[128];
+    float dists[128] = { 0 }, uplims[128];
     float maxvals[128];
     int fflag, minscaler;
     int its  = 0;
@@ -722,7 +722,6 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
     float minthr = INFINITY;
 
     //XXX: some heuristic to determine initial quantizers will reduce search time
-    memset(dists, 0, sizeof(dists));
     //determine zero bands and upper limits
     for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
         for (g = 0;  g < sce->ics.num_swb; g++) {
diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
index 8ee393a..42db471 100644
--- a/libavcodec/aacpsy.c
+++ b/libavcodec/aacpsy.c
@@ -389,9 +389,8 @@ static av_unused FFPsyWindowInfo psy_3gpp_window(FFPsyContext *ctx,
     AacPsyChannel *pch  = &pctx->ch[channel];
     uint8_t grouping     = 0;
     int next_type        = pch->next_window_seq;
-    FFPsyWindowInfo wi;
+    FFPsyWindowInfo wi  = { { 0 } };
 
-    memset(&wi, 0, sizeof(wi));
     if (la) {
         float s[8], v;
         int switch_to_eight = 0;
@@ -785,9 +784,8 @@ static FFPsyWindowInfo psy_lame_window(FFPsyContext *ctx, const float *audio,
     int uselongblock = 1;
     int attacks[AAC_NUM_BLOCKS_SHORT + 1] = { 0 };
     int i;
-    FFPsyWindowInfo wi;
+    FFPsyWindowInfo wi = { { 0 } };
 
-    memset(&wi, 0, sizeof(wi));
     if (la) {
         float hpfsmpl[AAC_BLOCK_SIZE_LONG];
         float const *pf = hpfsmpl;
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index a8bc48a..3056403 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -753,9 +753,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
     int downmix_output;
     int cpl_in_use;
     GetBitContext *gbc = &s->gbc;
-    uint8_t bit_alloc_stages[AC3_MAX_CHANNELS];
-
-    memset(bit_alloc_stages, 0, AC3_MAX_CHANNELS);
+    uint8_t bit_alloc_stages[AC3_MAX_CHANNELS] = { 0 };
 
     /* block switch flags */
     different_transforms = 0;
diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index 1b916e4..35952ae 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1026,9 +1026,7 @@ static int decode_blocks_ind(ALSDecContext *ctx, unsigned int ra_frame,
                              unsigned int *js_blocks)
 {
     unsigned int b;
-    ALSBlockData bd;
-
-    memset(&bd, 0, sizeof(ALSBlockData));
+    ALSBlockData bd = { 0 };
 
     bd.ra_block         = ra_frame;
     bd.const_block      = ctx->const_block;
@@ -1069,9 +1067,7 @@ static int decode_blocks(ALSDecContext *ctx, unsigned int ra_frame,
     ALSSpecificConfig *sconf = &ctx->sconf;
     unsigned int offset = 0;
     unsigned int b;
-    ALSBlockData bd[2];
-
-    memset(bd, 0, 2 * sizeof(ALSBlockData));
+    ALSBlockData bd[2] = { { 0 } };
 
     bd[0].ra_block         = ra_frame;
     bd[0].const_block      = ctx->const_block;
@@ -1337,7 +1333,7 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
                     sizeof(*ctx->raw_samples[c]) * sconf->max_order);
         }
     } else { // multi-channel coding
-        ALSBlockData   bd;
+        ALSBlockData   bd = { 0 };
         int            b;
         int            *reverted_channels = ctx->reverted_channels;
         unsigned int   offset             = 0;
@@ -1348,7 +1344,6 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
                 return -1;
             }
 
-        memset(&bd,               0, sizeof(ALSBlockData));
         memset(reverted_channels, 0, sizeof(*reverted_channels) * avctx->channels);
 
         bd.ra_block         = ra_frame;
diff --git a/libavcodec/bink.c b/libavcodec/bink.c
index 4e9b1a8..47f4b72 100644
--- a/libavcodec/bink.c
+++ b/libavcodec/bink.c
@@ -233,7 +233,7 @@ static void merge(GetBitContext *gb, uint8_t *dst, uint8_t *src, int size)
  */
 static void read_tree(GetBitContext *gb, Tree *tree)
 {
-    uint8_t tmp1[16], tmp2[16], *in = tmp1, *out = tmp2;
+    uint8_t tmp1[16] = { 0 }, tmp2[16], *in = tmp1, *out = tmp2;
     int i, t, len;
 
     tree->vlc_num = get_bits(gb, 4);
@@ -244,7 +244,6 @@ static void read_tree(GetBitContext *gb, Tree *tree)
     }
     if (get_bits1(gb)) {
         len = get_bits(gb, 3);
-        memset(tmp1, 0, sizeof(tmp1));
         for (i = 0; i <= len; i++) {
             tree->syms[i] = get_bits(gb, 4);
             tmp1[tree->syms[i]] = 1;
diff --git a/libavcodec/cook.c b/libavcodec/cook.c
index 7437852..217abcf 100644
--- a/libavcodec/cook.c
+++ b/libavcodec/cook.c
@@ -411,10 +411,10 @@ static void categorize(COOKContext *q, COOKSubpacket *p, int *quant_index_table,
                        int *category, int *category_index)
 {
     int exp_idx, bias, tmpbias1, tmpbias2, bits_left, num_bits, index, v, i, j;
-    int exp_index2[102];
-    int exp_index1[102];
+    int exp_index2[102] = { 0 };
+    int exp_index1[102] = { 0 };
 
-    int tmp_categorize_array[128 * 2];
+    int tmp_categorize_array[128 * 2] = { 0 };
     int tmp_categorize_array1_idx = p->numvector_size;
     int tmp_categorize_array2_idx = p->numvector_size;
 
@@ -426,10 +426,6 @@ static void categorize(COOKContext *q, COOKSubpacket *p, int *quant_index_table,
         //av_log(q->avctx, AV_LOG_ERROR, "bits_left = %d\n",bits_left);
     }
 
-    memset(&exp_index1,           0, sizeof(exp_index1));
-    memset(&exp_index2,           0, sizeof(exp_index2));
-    memset(&tmp_categorize_array, 0, sizeof(tmp_categorize_array));
-
     bias = -32;
 
     /* Estimate bias. */
@@ -649,14 +645,11 @@ static void decode_vectors(COOKContext *q, COOKSubpacket *p, int *category,
  */
 static int mono_decode(COOKContext *q, COOKSubpacket *p, float *mlt_buffer)
 {
-    int category_index[128];
+    int category_index[128] = { 0 };
+    int category[128]       = { 0 };
     int quant_index_table[102];
-    int category[128];
     int res;
 
-    memset(&category,       0, sizeof(category));
-    memset(&category_index, 0, sizeof(category_index));
-
     if ((res = decode_envelope(q, p, quant_index_table)) < 0)
         return res;
     q->num_vectors = get_bits(&q->gb, p->log2_numvector_size);
@@ -818,13 +811,12 @@ static int joint_decode(COOKContext *q, COOKSubpacket *p, float *mlt_buffer1,
                         float *mlt_buffer2)
 {
     int i, j, res;
-    int decouple_tab[SUBBAND_SIZE];
+    int decouple_tab[SUBBAND_SIZE] = { 0 };
     float *decode_buffer = q->decode_buffer_0;
     int idx, cpl_tmp;
     float f1, f2;
     const float *cplscale;
 
-    memset(decouple_tab, 0, sizeof(decouple_tab));
     memset(decode_buffer, 0, sizeof(q->decode_buffer_0));
 
     /* Make sure the buffers are zeroed out. */
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index ee9331c..83e71d1 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -120,13 +120,12 @@ static void guess_palette(uint32_t *rgba_palette,
                           uint8_t *alpha,
                           uint32_t subtitle_color)
 {
-    uint8_t color_used[16];
+    uint8_t color_used[16] = { 0 };
     int nb_opaque_colors, i, level, j, r, g, b;
 
     for(i = 0; i < 4; i++)
         rgba_palette[i] = 0;
 
-    memset(color_used, 0, 16);
     nb_opaque_colors = 0;
     for(i = 0; i < 4; i++) {
         if (alpha[i] != 0 && !color_used[colormap[i]]) {
@@ -371,14 +370,13 @@ static int is_transp(const uint8_t *buf, int pitch, int n,
 /* return 0 if empty rectangle, 1 if non empty */
 static int find_smallest_bounding_rectangle(AVSubtitle *s)
 {
-    uint8_t transp_color[256];
+    uint8_t transp_color[256] = { 0 };
     int y1, y2, x1, x2, y, w, h, i;
     uint8_t *bitmap;
 
     if (s->num_rects == 0 || s->rects == NULL || s->rects[0]->w <= 0 || s->rects[0]->h <= 0)
         return 0;
 
-    memset(transp_color, 0, 256);
     for(i = 0; i < s->rects[0]->nb_colors; i++) {
         if ((((uint32_t*)s->rects[0]->pict.data[1])[i] >> 24) == 0)
             transp_color[i] = 1;
diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c
index d7d893c..71c8405 100644
--- a/libavcodec/dxva2.c
+++ b/libavcodec/dxva2.c
@@ -86,7 +86,7 @@ int ff_dxva2_common_end_frame(AVCodecContext *avctx, MpegEncContext *s,
     struct dxva_context *ctx = avctx->hwaccel_context;
     unsigned               buffer_count = 0;
     DXVA2_DecodeBufferDesc buffer[4];
-    DXVA2_DecodeExecuteParams exec;
+    DXVA2_DecodeExecuteParams exec = { 0 };
     int      result;
 
     if (FAILED(IDirectXVideoDecoder_BeginFrame(ctx->decoder,
@@ -132,7 +132,6 @@ int ff_dxva2_common_end_frame(AVCodecContext *avctx, MpegEncContext *s,
 
     assert(buffer_count == 1 + (qm_size > 0) + 2);
 
-    memset(&exec, 0, sizeof(exec));
     exec.NumCompBuffers      = buffer_count;
     exec.pCompressedBuffers  = buffer;
     exec.pExtensionData      = NULL;
diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index 6a4032d..8ce7a23 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -573,8 +573,7 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
             av_fifo_generic_write(fpc->fifo_buf, (void*) read_start,
                                   read_end - read_start, NULL);
         } else {
-            int8_t pad[MAX_FRAME_HEADER_SIZE];
-            memset(pad, 0, sizeof(pad));
+            int8_t pad[MAX_FRAME_HEADER_SIZE] = { 0 };
             av_fifo_generic_write(fpc->fifo_buf, (void*) pad, sizeof(pad), NULL);
         }
 
diff --git a/libavcodec/intrax8dsp.c b/libavcodec/intrax8dsp.c
index 1a62fcd..0e79276 100644
--- a/libavcodec/intrax8dsp.c
+++ b/libavcodec/intrax8dsp.c
@@ -152,10 +152,8 @@ static void spatial_compensation_0(uint8_t *src , uint8_t *dst, int linesize){
     int x,y;
     unsigned int p;//power divided by 2
     int a;
-    uint16_t left_sum[2][8];
-    uint16_t  top_sum[2][8];
-    memset(left_sum,0,2*8*sizeof(uint16_t));
-    memset( top_sum,0,2*8*sizeof(uint16_t));
+    uint16_t left_sum[2][8] = { { 0 } };
+    uint16_t  top_sum[2][8] = { { 0 } };
 
     for(i=0;i<8;i++){
         a=src[area2+7-i]<<4;
diff --git a/libavcodec/jpeglsenc.c b/libavcodec/jpeglsenc.c
index d3f2e0f..2606706 100644
--- a/libavcodec/jpeglsenc.c
+++ b/libavcodec/jpeglsenc.c
@@ -210,8 +210,7 @@ static inline void ls_encode_line(JLSState *state, PutBitContext *pb, void *last
 
 static void ls_store_lse(JLSState *state, PutBitContext *pb){
     /* Test if we have default params and don't need to store LSE */
-    JLSState state2;
-    memset(&state2, 0, sizeof(JLSState));
+    JLSState state2 = { 0 };
     state2.bpp = state->bpp;
     state2.near = state->near;
     ff_jpegls_reset_coding_parameters(&state2, 1);
diff --git a/libavcodec/libxvid_rc.c b/libavcodec/libxvid_rc.c
index 7a0e60d..e871427 100644
--- a/libavcodec/libxvid_rc.c
+++ b/libavcodec/libxvid_rc.c
@@ -35,8 +35,8 @@ extern unsigned int xvid_debug;
 int ff_xvid_rate_control_init(MpegEncContext *s){
     char *tmp_name;
     int fd, i;
-    xvid_plg_create_t xvid_plg_create;
-    xvid_plugin_2pass2_t xvid_2pass2;
+    xvid_plg_create_t xvid_plg_create = { 0 };
+    xvid_plugin_2pass2_t xvid_2pass2  = { 0 };
 
 //xvid_debug=-1;
 
@@ -63,7 +63,6 @@ int ff_xvid_rate_control_init(MpegEncContext *s){
 
     close(fd);
 
-    memset(&xvid_2pass2, 0, sizeof(xvid_2pass2));
     xvid_2pass2.version= XVID_MAKE_VERSION(1,1,0);
     xvid_2pass2.filename= tmp_name;
     xvid_2pass2.bitrate= s->avctx->bit_rate;
@@ -71,7 +70,6 @@ int ff_xvid_rate_control_init(MpegEncContext *s){
     xvid_2pass2.vbv_maxrate= s->avctx->rc_max_rate;
     xvid_2pass2.vbv_initial= s->avctx->rc_initial_buffer_occupancy;
 
-    memset(&xvid_plg_create, 0, sizeof(xvid_plg_create));
     xvid_plg_create.version= XVID_MAKE_VERSION(1,1,0);
     xvid_plg_create.fbase= s->avctx->time_base.den;
     xvid_plg_create.fincr= s->avctx->time_base.num;
@@ -85,9 +83,8 @@ int ff_xvid_rate_control_init(MpegEncContext *s){
 }
 
 float ff_xvid_rate_estimate_qscale(MpegEncContext *s, int dry_run){
-    xvid_plg_data_t xvid_plg_data;
+    xvid_plg_data_t xvid_plg_data = { 0 };
 
-    memset(&xvid_plg_data, 0, sizeof(xvid_plg_data));
     xvid_plg_data.version= XVID_MAKE_VERSION(1,1,0);
     xvid_plg_data.width = s->width;
     xvid_plg_data.height= s->height;
diff --git a/libavcodec/libxvidff.c b/libavcodec/libxvidff.c
index 44580d1..0193bc8 100644
--- a/libavcodec/libxvidff.c
+++ b/libavcodec/libxvidff.c
@@ -131,11 +131,11 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx)  {
     uint16_t *intra, *inter;
     int fd;
 
-    xvid_plugin_single_t single;
-    struct xvid_ff_pass1 rc2pass1;
-    xvid_plugin_2pass2_t rc2pass2;
-    xvid_gbl_init_t xvid_gbl_init;
-    xvid_enc_create_t xvid_enc_create;
+    xvid_plugin_single_t single       = { 0 };
+    struct xvid_ff_pass1 rc2pass1     = { 0 };
+    xvid_plugin_2pass2_t rc2pass2     = { 0 };
+    xvid_gbl_init_t xvid_gbl_init     = { 0 };
+    xvid_enc_create_t xvid_enc_create = { 0 };
     xvid_enc_plugin_t plugins[7];
 
     /* Bring in VOP flags from avconv command-line */
@@ -205,7 +205,6 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx)  {
             x->me_flags |= XVID_ME_QUARTERPELREFINE8;
     }
 
-    memset(&xvid_gbl_init, 0, sizeof(xvid_gbl_init));
     xvid_gbl_init.version = XVID_VERSION;
     xvid_gbl_init.debug = 0;
 
@@ -226,7 +225,6 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx)  {
     xvid_global(NULL, XVID_GBL_INIT, &xvid_gbl_init, NULL);
 
     /* Create the encoder reference */
-    memset(&xvid_enc_create, 0, sizeof(xvid_enc_create));
     xvid_enc_create.version = XVID_VERSION;
 
     /* Store the desired frame size */
@@ -251,7 +249,6 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx)  {
     x->twopassfile = NULL;
 
     if( xvid_flags & CODEC_FLAG_PASS1 ) {
-        memset(&rc2pass1, 0, sizeof(struct xvid_ff_pass1));
         rc2pass1.version = XVID_VERSION;
         rc2pass1.context = x;
         x->twopassbuffer = av_malloc(BUFFER_SIZE);
@@ -267,7 +264,6 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx)  {
         plugins[xvid_enc_create.num_plugins].param = &rc2pass1;
         xvid_enc_create.num_plugins++;
     } else if( xvid_flags & CODEC_FLAG_PASS2 ) {
-        memset(&rc2pass2, 0, sizeof(xvid_plugin_2pass2_t));
         rc2pass2.version = XVID_VERSION;
         rc2pass2.bitrate = avctx->bit_rate;
 
@@ -299,7 +295,6 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx)  {
         xvid_enc_create.num_plugins++;
     } else if( !(xvid_flags & CODEC_FLAG_QSCALE) ) {
         /* Single Pass Bitrate Control! */
-        memset(&single, 0, sizeof(xvid_plugin_single_t));
         single.version = XVID_VERSION;
         single.bitrate = avctx->bit_rate;
 
@@ -419,8 +414,8 @@ static int xvid_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     int mb_width   = (avctx->width  + 15) / 16;
     int mb_height  = (avctx->height + 15) / 16;
 
-    xvid_enc_frame_t xvid_enc_frame;
-    xvid_enc_stats_t xvid_enc_stats;
+    xvid_enc_frame_t xvid_enc_frame = { 0 };
+    xvid_enc_stats_t xvid_enc_stats = { 0 };
 
     if (!user_packet &&
         (ret = av_new_packet(pkt, mb_width*mb_height*MAX_MB_BYTES + FF_MIN_BUFFER_SIZE)) < 0) {
@@ -429,9 +424,7 @@ static int xvid_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     }
 
     /* Start setting up the frame */
-    memset(&xvid_enc_frame, 0, sizeof(xvid_enc_frame));
     xvid_enc_frame.version = XVID_VERSION;
-    memset(&xvid_enc_stats, 0, sizeof(xvid_enc_stats));
     xvid_enc_stats.version = XVID_VERSION;
     *p = *picture;
 
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 1c5fa79..5eab559 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -46,14 +46,13 @@ static int build_vlc(VLC *vlc, const uint8_t *bits_table,
                      const uint8_t *val_table, int nb_codes,
                      int use_static, int is_ac)
 {
-    uint8_t huff_size[256];
+    uint8_t huff_size[256] = { 0 };
     uint16_t huff_code[256];
     uint16_t huff_sym[256];
     int i;
 
     assert(nb_codes <= 256);
 
-    memset(huff_size, 0, sizeof(huff_size));
     ff_mjpeg_build_huffman_codes(huff_size, huff_code, bits_table, val_table);
 
     for (i = 0; i < 256; i++)
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index 2aa8978..ce802e5 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -1424,9 +1424,8 @@ static inline int bidir_refine(MpegEncContext * s, int mb_x, int mb_y)
 #define HASH(fx,fy,bx,by) ((fx)+17*(fy)+63*(bx)+117*(by))
 #define HASH8(fx,fy,bx,by) ((uint8_t)HASH(fx,fy,bx,by))
     int hashidx= HASH(motion_fx,motion_fy, motion_bx, motion_by);
-    uint8_t map[256];
+    uint8_t map[256] = { 0 };
 
-    memset(map,0,sizeof(map));
     map[hashidx&255] = 1;
 
     fbmin= check_bidir_mv(s, motion_fx, motion_fy,
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index dd43beb..6ed124b 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -304,11 +304,8 @@ static av_cold void decode_init_static(void)
     for (i = 1; i < 16; i++) {
         const HuffTable *h = &mpa_huff_tables[i];
         int xsize, x, y;
-        uint8_t  tmp_bits [512];
-        uint16_t tmp_codes[512];
-
-        memset(tmp_bits , 0, sizeof(tmp_bits ));
-        memset(tmp_codes, 0, sizeof(tmp_codes));
+        uint8_t  tmp_bits [512] = { 0 };
+        uint16_t tmp_codes[512] = { 0 };
 
         xsize = h->xsize;
 
diff --git a/libavcodec/ra144enc.c b/libavcodec/ra144enc.c
index bbea9d7..47f0d6d 100644
--- a/libavcodec/ra144enc.c
+++ b/libavcodec/ra144enc.c
@@ -342,7 +342,7 @@ static void ra144_encode_subblock(RA144Context *ractx,
                                   const int16_t *lpc_coefs, unsigned int rms,
                                   PutBitContext *pb)
 {
-    float data[BLOCKSIZE], work[LPC_ORDER + BLOCKSIZE];
+    float data[BLOCKSIZE] = { 0 }, work[LPC_ORDER + BLOCKSIZE];
     float coefs[LPC_ORDER];
     float zero[BLOCKSIZE], cba[BLOCKSIZE], cb1[BLOCKSIZE], cb2[BLOCKSIZE];
     int16_t cba_vect[BLOCKSIZE];
@@ -360,7 +360,6 @@ static void ra144_encode_subblock(RA144Context *ractx,
      * Calculate the zero-input response of the LPC filter and subtract it from
      * input data.
      */
-    memset(data, 0, sizeof(data));
     ff_celp_lp_synthesis_filterf(work + LPC_ORDER, coefs, data, BLOCKSIZE,
                                  LPC_ORDER);
     for (i = 0; i < BLOCKSIZE; i++) {
diff --git a/libavcodec/rangecoder.c b/libavcodec/rangecoder.c
index 1cd6762..b0c9f21 100644
--- a/libavcodec/rangecoder.c
+++ b/libavcodec/rangecoder.c
@@ -119,7 +119,7 @@ int main(void){
     uint8_t b[9*SIZE];
     uint8_t r[9*SIZE];
     int i;
-    uint8_t state[10]= {0};
+    uint8_t state[10];
     AVLFG prng;
 
     av_lfg_init(&prng, 1);
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index b366ead..3ad1717 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -554,7 +554,7 @@ static void rv34_pred_mv_b(RV34DecContext *r, int block_type, int dir)
     MpegEncContext *s = &r->s;
     int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
     int mv_pos = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride;
-    int A[2], B[2], C[2];
+    int A[2] = { 0 }, B[2] = { 0 }, C[2] = { 0 };
     int has_A = 0, has_B = 0, has_C = 0;
     int mx, my;
     int i, j;
@@ -562,9 +562,6 @@ static void rv34_pred_mv_b(RV34DecContext *r, int block_type, int dir)
     const int mask = dir ? MB_TYPE_L1 : MB_TYPE_L0;
     int type = cur_pic->f.mb_type[mb_pos];
 
-    memset(A, 0, sizeof(A));
-    memset(B, 0, sizeof(B));
-    memset(C, 0, sizeof(C));
     if((r->avail_cache[6-1] & type) & mask){
         A[0] = cur_pic->f.motion_val[dir][mv_pos - 1][0];
         A[1] = cur_pic->f.motion_val[dir][mv_pos - 1][1];
diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
index 05f4a92..d425387 100644
--- a/libavcodec/smacker.c
+++ b/libavcodec/smacker.c
@@ -180,7 +180,7 @@ static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int
     int res;
     HuffContext huff;
     HuffContext tmp1, tmp2;
-    VLC vlc[2];
+    VLC vlc[2] = { { 0 } };
     int escapes[3];
     DBCtx ctx;
     int err = 0;
@@ -204,9 +204,6 @@ static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int
     tmp2.lengths = av_mallocz(256 * sizeof(int));
     tmp2.values = av_mallocz(256 * sizeof(int));
 
-    memset(&vlc[0], 0, sizeof(VLC));
-    memset(&vlc[1], 0, sizeof(VLC));
-
     if(get_bits1(gb)) {
         smacker_decode_tree(gb, &tmp1, 0, 0);
         skip_bits1(gb);
@@ -591,8 +588,8 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data,
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     GetBitContext gb;
-    HuffContext h[4];
-    VLC vlc[4];
+    HuffContext h[4] = { { 0 } };
+    VLC vlc[4]       = { { 0 } };
     int16_t *samples;
     uint8_t *samples8;
     int val;
@@ -635,8 +632,6 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data,
     samples  = (int16_t *)s->frame.data[0];
     samples8 =            s->frame.data[0];
 
-    memset(vlc, 0, sizeof(VLC) * 4);
-    memset(h, 0, sizeof(HuffContext) * 4);
     // Initialize
     for(i = 0; i < (1 << (bits + stereo)); i++) {
         h[i].length = 256;
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 9ca9163..adbd15c 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -83,10 +83,9 @@ static unsigned tget(const uint8_t **p, int type, int le) {
 #if CONFIG_ZLIB
 static int tiff_uncompress(uint8_t *dst, unsigned long *len, const uint8_t *src, int size)
 {
-    z_stream zstream;
+    z_stream zstream = { 0 };
     int zret;
 
-    memset(&zstream, 0, sizeof(zstream));
     zstream.next_in = src;
     zstream.avail_in = size;
     zstream.next_out = dst;
diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c
index fcf6004..a3bd373 100644
--- a/libavcodec/truemotion1.c
+++ b/libavcodec/truemotion1.c
@@ -310,7 +310,7 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
     int width_shift = 0;
     int new_pix_fmt;
     struct frame_header header;
-    uint8_t header_buffer[128];  /* logical maximum size of the header */
+    uint8_t header_buffer[128] = { 0 };  /* logical maximum size of the header */
     const uint8_t *sel_vector_table;
 
     header.header_size = ((s->buf[0] >> 5) | (s->buf[0] << 3)) & 0x7f;
@@ -321,7 +321,6 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
     }
 
     /* unscramble the header bytes with a XOR operation */
-    memset(header_buffer, 0, 128);
     for (i = 1; i < header.header_size; i++)
         header_buffer[i - 1] = s->buf[i] ^ s->buf[i + 1];
 
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index 65ca3c8..ce87aef 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -521,7 +521,7 @@ static int decode_subframe_length(WMAProDecodeCtx *s, int offset)
  */
 static int decode_tilehdr(WMAProDecodeCtx *s)
 {
-    uint16_t num_samples[WMAPRO_MAX_CHANNELS];        /**< sum of samples for all currently known subframes of a channel */
+    uint16_t num_samples[WMAPRO_MAX_CHANNELS] = { 0 };/**< sum of samples for all currently known subframes of a channel */
     uint8_t  contains_subframe[WMAPRO_MAX_CHANNELS];  /**< flag indicating if a channel contains the current subframe */
     int channels_for_cur_subframe = s->num_channels;  /**< number of channels that contain the current subframe */
     int fixed_channel_layout = 0;                     /**< flag indicating that all channels use the same subframe offsets and sizes */
@@ -538,8 +538,6 @@ static int decode_tilehdr(WMAProDecodeCtx *s)
     for (c = 0; c < s->num_channels; c++)
         s->channel[c].num_subframes = 0;
 
-    memset(num_samples, 0, sizeof(num_samples));
-
     if (s->max_num_subframes == 1 || get_bits1(&s->gb))
         fixed_channel_layout = 1;
 
diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
index a222f09..ebc6a59 100644
--- a/libavcodec/wmavoice.c
+++ b/libavcodec/wmavoice.c
@@ -318,10 +318,9 @@ static av_cold int decode_vbmtree(GetBitContext *gb, int8_t vbm_tree[25])
           0x0ffc, 0x0ffd, 0x0ffe,        //   1111111111+00/01/10
           0x3ffc, 0x3ffd, 0x3ffe, 0x3fff // 111111111111+xx
     };
-    int cntr[8], n, res;
+    int cntr[8] = { 0 }, n, res;
 
     memset(vbm_tree, 0xff, sizeof(vbm_tree[0]) * 25);
-    memset(cntr,     0,    sizeof(cntr));
     for (n = 0; n < 17; n++) {
         res = get_bits(gb, 3);
         if (cntr[res] > 3) // should be >= 3 + (res == 7))
diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c
index b35ec7c..42ee0b3 100644
--- a/libavdevice/bktr.c
+++ b/libavdevice/bktr.c
@@ -102,7 +102,7 @@ static av_cold int bktr_init(const char *video_device, int width, int height,
     long ioctl_frequency;
     char *arg;
     int c;
-    struct sigaction act, old;
+    struct sigaction act = { 0 }, old;
 
     if (idev < 0 || idev > 4)
     {
@@ -131,7 +131,6 @@ static av_cold int bktr_init(const char *video_device, int width, int height,
             frequency = 0.0;
     }
 
-    memset(&act, 0, sizeof(act));
     sigemptyset(&act.sa_mask);
     act.sa_handler = catchsignal;
     sigaction(SIGUSR1, &act, &old);
diff --git a/libavformat/asfcrypt.c b/libavformat/asfcrypt.c
index aea3d4f..6c48a19 100644
--- a/libavformat/asfcrypt.c
+++ b/libavformat/asfcrypt.c
@@ -140,7 +140,7 @@ void ff_asfcrypt_dec(const uint8_t key[20], uint8_t *data, int len) {
     struct AVRC4 rc4;
     int num_qwords = len >> 3;
     uint8_t *qwords = data;
-    uint64_t rc4buff[8];
+    uint64_t rc4buff[8] = { 0 };
     uint64_t packetkey;
     uint32_t ms_keys[12];
     uint64_t ms_state;
@@ -151,7 +151,6 @@ void ff_asfcrypt_dec(const uint8_t key[20], uint8_t *data, int len) {
         return;
     }
 
-    memset(rc4buff, 0, sizeof(rc4buff));
     av_rc4_init(&rc4, key, 12 * 8, 1);
     av_rc4_crypt(&rc4, (uint8_t *)rc4buff, NULL, sizeof(rc4buff), NULL, 1);
     multiswap_init((uint8_t *)rc4buff, ms_keys);
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 1d808f1..f776c75 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -983,7 +983,7 @@ static int mov_write_pasp_tag(AVIOContext *pb, MOVTrack *track)
 static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
 {
     int64_t pos = avio_tell(pb);
-    char compressor_name[32];
+    char compressor_name[32] = { 0 };
 
     avio_wb32(pb, 0); /* size */
     avio_wl32(pb, track->tag); // store it byteswapped
@@ -1014,7 +1014,6 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
     avio_wb32(pb, 0); /* Data size (= 0) */
     avio_wb16(pb, 1); /* Frame count (= 1) */
 
-    memset(compressor_name,0,32);
     /* FIXME not sure, ISO 14496-1 draft where it shall be set to 0 */
     if (track->mode == MODE_MOV && track->enc->codec && track->enc->codec->name)
         av_strlcpy(compressor_name,track->enc->codec->name,32);
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 07cf809..fa761f5 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -157,8 +157,7 @@ static void rtsp_parse_range_npt(const char *p, int64_t *start, int64_t *end)
 
 static int get_sockaddr(const char *buf, struct sockaddr_storage *sock)
 {
-    struct addrinfo hints, *ai = NULL;
-    memset(&hints, 0, sizeof(hints));
+    struct addrinfo hints = { 0 }, *ai = NULL;
     hints.ai_flags = AI_NUMERICHOST;
     if (getaddrinfo(buf, NULL, &hints, &ai))
         return -1;
@@ -497,9 +496,8 @@ int ff_sdp_parse(AVFormatContext *s, const char *content)
      * The Vorbis FMTP line can be up to 16KB - see xiph_parse_sdp_line
      * in rtpdec_xiph.c. */
     char buf[16384], *q;
-    SDPParseState sdp_parse_state, *s1 = &sdp_parse_state;
+    SDPParseState sdp_parse_state = { { 0 } }, *s1 = &sdp_parse_state;
 
-    memset(s1, 0, sizeof(SDPParseState));
     p = content;
     for (;;) {
         p += strspn(p, SPACE_CHARS);
@@ -1955,7 +1953,7 @@ static int rtp_read_header(AVFormatContext *s)
     int ret, port;
     URLContext* in = NULL;
     int payload_type;
-    AVCodecContext codec;
+    AVCodecContext codec = { 0 };
     struct sockaddr_storage addr;
     AVIOContext pb;
     socklen_t addrlen = sizeof(addr);
@@ -1996,7 +1994,6 @@ static int rtp_read_header(AVFormatContext *s)
     ffurl_close(in);
     in = NULL;
 
-    memset(&codec, 0, sizeof(codec));
     if (ff_rtp_get_codec_info(&codec, payload_type)) {
         av_log(s, AV_LOG_ERROR, "Unable to receive RTP payload type %d "
                                 "without an SDP file describing it\n",
diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c
index dbd7bdb..0913dd7 100644
--- a/libavformat/sapenc.c
+++ b/libavformat/sapenc.c
@@ -104,8 +104,7 @@ static int sap_write_header(AVFormatContext *s)
     }
 
     if (!announce_addr[0]) {
-        struct addrinfo hints, *ai = NULL;
-        memset(&hints, 0, sizeof(hints));
+        struct addrinfo hints = { 0 }, *ai = NULL;
         hints.ai_family = AF_UNSPEC;
         if (getaddrinfo(host, NULL, &hints, &ai)) {
             av_log(s, AV_LOG_ERROR, "Unable to resolve %s\n", host);
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index b2c4f7b..9692aab 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -88,7 +88,7 @@ static void sdp_write_header(char *buff, int size, struct sdp_session_level *s)
 static int resolve_destination(char *dest_addr, int size, char *type,
                                int type_size)
 {
-    struct addrinfo hints, *ai;
+    struct addrinfo hints = { 0 }, *ai;
     int is_multicast;
 
     av_strlcpy(type, "IP4", type_size);
@@ -98,7 +98,6 @@ static int resolve_destination(char *dest_addr, int size, char *type,
     /* Resolve the destination, since it must be written
      * as a numeric IP address in the SDP. */
 
-    memset(&hints, 0, sizeof(hints));
     if (getaddrinfo(dest_addr, NULL, &hints, &ai))
         return 0;
     getnameinfo(ai->ai_addr, ai->ai_addrlen, dest_addr, size,
@@ -581,12 +580,11 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *des
 int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
 {
     AVDictionaryEntry *title = av_dict_get(ac[0]->metadata, "title", NULL, 0);
-    struct sdp_session_level s;
+    struct sdp_session_level s = { 0 };
     int i, j, port, ttl, is_multicast;
     char dst[32], dst_type[5];
 
     memset(buf, 0, size);
-    memset(&s, 0, sizeof(struct sdp_session_level));
     s.user = "-";
     s.src_addr = "127.0.0.1";    /* FIXME: Properly set this */
     s.src_type = "IP4";
diff --git a/libavformat/seek-test.c b/libavformat/seek-test.c
index 699c693..57d3fa4 100644
--- a/libavformat/seek-test.c
+++ b/libavformat/seek-test.c
@@ -93,11 +93,10 @@ int main(int argc, char **argv)
     }
 
     for(i=0; ; i++){
-        AVPacket pkt;
+        AVPacket pkt = { 0 };
         AVStream *av_uninit(st);
         char ts_buf[60];
 
-        memset(&pkt, 0, sizeof(pkt));
         if(ret>=0){
             ret= av_read_frame(ic, &pkt);
             if(ret>=0){
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index fdb457e..0ed11f3 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -37,7 +37,7 @@ typedef struct TCPContext {
 /* return non zero if error */
 static int tcp_open(URLContext *h, const char *uri, int flags)
 {
-    struct addrinfo hints, *ai, *cur_ai;
+    struct addrinfo hints = { 0 }, *ai, *cur_ai;
     int port, fd = -1;
     TCPContext *s = h->priv_data;
     int listen_socket = 0;
@@ -62,7 +62,6 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
             timeout = strtol(buf, NULL, 10);
         }
     }
-    memset(&hints, 0, sizeof(hints));
     hints.ai_family = AF_UNSPEC;
     hints.ai_socktype = SOCK_STREAM;
     snprintf(portstr, sizeof(portstr), "%d", port);
diff --git a/libavformat/udp.c b/libavformat/udp.c
index 37b7655..6571ab5 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -140,7 +140,7 @@ static int udp_leave_multicast_group(int sockfd, struct sockaddr *addr)
 static struct addrinfo* udp_resolve_host(const char *hostname, int port,
                                          int type, int family, int flags)
 {
-    struct addrinfo hints, *res = 0;
+    struct addrinfo hints = { 0 }, *res = 0;
     int error;
     char sport[16];
     const char *node = 0, *service = "0";
@@ -152,7 +152,6 @@ static struct addrinfo* udp_resolve_host(const char *hostname, int port,
     if ((hostname) && (hostname[0] != '\0') && (hostname[0] != '?')) {
         node = hostname;
     }
-    memset(&hints, 0, sizeof(hints));
     hints.ai_socktype = type;
     hints.ai_family   = family;
     hints.ai_flags = flags;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index cb708ad..f38045c 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3668,7 +3668,7 @@ int ff_url_join(char *str, int size, const char *proto,
                 int port, const char *fmt, ...)
 {
 #if CONFIG_NETWORK
-    struct addrinfo hints, *ai;
+    struct addrinfo hints = { 0 }, *ai;
 #endif
 
     str[0] = '\0';
@@ -3679,7 +3679,6 @@ int ff_url_join(char *str, int size, const char *proto,
 #if CONFIG_NETWORK && defined(AF_INET6)
     /* Determine if hostname is a numerical IPv6 address,
      * properly escape it within [] in that case. */
-    memset(&hints, 0, sizeof(hints));
     hints.ai_flags = AI_NUMERICHOST;
     if (!getaddrinfo(hostname, NULL, &hints, &ai)) {
         if (ai->ai_family == AF_INET6) {
diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c
index 8c8251b..3d28e56 100644
--- a/libavutil/imgutils.c
+++ b/libavutil/imgutils.c
@@ -93,12 +93,10 @@ int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int widt
 int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
                            uint8_t *ptr, const int linesizes[4])
 {
-    int i, total_size, size[4], has_plane[4];
+    int i, total_size, size[4] = { 0 }, has_plane[4] = { 0 };
 
     const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
     memset(data     , 0, sizeof(data[0])*4);
-    memset(size     , 0, sizeof(size));
-    memset(has_plane, 0, sizeof(has_plane));
 
     if ((unsigned)pix_fmt >= PIX_FMT_NB || desc->flags & PIX_FMT_HWACCEL)
         return AVERROR(EINVAL);
diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c
index a1d221b..ed147ee 100644
--- a/libavutil/parseutils.c
+++ b/libavutil/parseutils.c
@@ -484,7 +484,7 @@ int av_parse_time(int64_t *timeval, const char *timestr, int duration)
 {
     const char *p;
     int64_t t;
-    struct tm dt;
+    struct tm dt = { 0 };
     int i;
     static const char * const date_fmt[] = {
         "%Y-%m-%d",
@@ -509,8 +509,6 @@ int av_parse_time(int64_t *timeval, const char *timestr, int duration)
         lastch = '\0';
     is_utc = (lastch == 'z' || lastch == 'Z');
 
-    memset(&dt, 0, sizeof(dt));
-
     p = timestr;
     q = NULL;
     if (!duration) {



More information about the ffmpeg-cvslog mailing list