gst-plugins-bad: hls: bring NULL test before dereference

Tim-Philipp Müller t.i.m at zen.co.uk
Tue Apr 8 09:02:03 PDT 2014


On Tue, 2014-04-08 at 08:47 -0700, Vincent Penquerc'h wrote:

Vincent,

It's great that you're going through the coverity issues, but ..

> Module: gst-plugins-bad
> Branch: master
> Commit: 45b8225a0214d8f2a9072ce1ff6006d6aeb6a289
> URL:
> http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=45b8225a0214d8f2a9072ce1ff6006d6aeb6a289
> 
> Author: Vincent Penquerc'h <vincent.penquerch at collabora.co.uk>
> Date:   Tue Apr  8 16:46:56 2014 +0100
> 
> hls: bring NULL test before dereference

> @@ -808,11 +808,11 @@ gst_m3u8_client_get_duration (GstM3U8Client * client)
>  
>    GST_M3U8_CLIENT_LOCK (client);
>    /* We can only get the duration for on-demand streams */
> -  if (!client->current->endlist) {
> +  if (!client->current || client->current->endlist) {

You dropped the ! before the endlist check, presumably not on purpose
since you didn't mentioned it in the commit message.

>      GST_M3U8_CLIENT_UNLOCK (client);
>      return GST_CLOCK_TIME_NONE;
>    }
> -  if (client->current && client->current->files)
> +  if (client->current->files)
>      g_list_foreach (client->current->files, (GFunc) _sum_duration, &duration);
>    GST_M3U8_CLIENT_UNLOCK (client);
>    return duration;

You also change the return value of the function for the case where
client->current is NULL, from 0 to CLOCK_TIME_NONE. I don't know if
that matters for anything in this particular case, but often things
like this do matter, and I guess it was not on purpose either.

Cheers
 -Tim




More information about the gstreamer-devel mailing list