audio/video: Initialize all {audio|video}info fields
authorEdward Hervey <edward@collabora.com>
Fri, 20 Dec 2013 13:41:45 +0000 (08:41 -0500)
committerEdward Hervey <bilboed@bilboed.com>
Fri, 20 Dec 2013 13:47:22 +0000 (14:47 +0100)
Fixes "Unitialized Scalar Variable" issues reported by Coverity.

Has the added advantage of detecting whether somebody *does* use those
fields (ending up with a invalid address).

https://bugzilla.gnome.org/show_bug.cgi?id=720810

gst-libs/gst/audio/audio-info.c
gst-libs/gst/video/video-info.c

index 2cae7e1..53cdd5b 100644 (file)
@@ -131,6 +131,7 @@ gst_audio_info_set_format (GstAudioInfo * info, GstAudioFormat format,
   info->bpf = (finfo->width * channels) / 8;
 
   memset (&info->position, 0xff, sizeof (info->position));
+  memset (&info->_gst_reserved, 0xff, sizeof (info->_gst_reserved));
 
   if (!position && channels == 1) {
     info->position[0] = GST_AUDIO_CHANNEL_POSITION_MONO;
index 6db2f66..8140228 100644 (file)
@@ -110,6 +110,7 @@ gst_video_info_set_format (GstVideoInfo * info, GstVideoFormat format,
   }
 
   fill_planes (info);
+  memset (&info->_gst_reserved, 0xff, sizeof (info->_gst_reserved));
 }
 
 static const gchar *interlace_mode[] = {