[Bug 79006] [next] Fix clang warnings

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon May 26 04:45:15 PDT 2014


https://bugs.freedesktop.org/show_bug.cgi?id=79006

--- Comment #20 from Guillaume Desmottes <guillaume.desmottes at collabora.co.uk> ---
(In reply to comment #14)
> Comment on attachment 99478 [details] [review]
> tp-fs: fix a potential NULL dereferencing crash
> 
> Review of attachment 99478 [details] [review]:
> -----------------------------------------------------------------
> 
> ::: telepathy-farstream/call-stream.c
> @@ +331,5 @@
> >        tf_call_stream_fail (self,
> >            TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
> >            TP_ERROR_STR_MEDIA_STREAMING_ERROR,
> > +          "Error setting the remote candidates: %s",
> > +          error != NULL ? error->message : "invalid transport type");
> 
> This usually indicates that GError is being used incorrectly; I'll have to
> look at more context.

The only case where it can happen, assuming the called functions properly set
the error if they failed, is the default switch case. We can just
g_return_if_reached() if you prefer.

static void
_tf_call_stream_push_remote_candidates (TfCallStream *self,
    GList *fscandidates)
{
  gboolean ret;
  GError *error = NULL;

  switch (self->transport_type)
    {
    case TP_STREAM_TRANSPORT_TYPE_RAW_UDP:
    case TP_STREAM_TRANSPORT_TYPE_SHM:
    case TP_STREAM_TRANSPORT_TYPE_MULTICAST:
      ret = fs_stream_force_remote_candidates (self->fsstream,
          fscandidates, &error);
      break;
    case TP_STREAM_TRANSPORT_TYPE_ICE:
    case TP_STREAM_TRANSPORT_TYPE_GTALK_P2P:
    case TP_STREAM_TRANSPORT_TYPE_WLM_2009:
      ret = fs_stream_add_remote_candidates (self->fsstream, fscandidates,
          &error);
      break;
    default:
      ret = FALSE;
    }

  if (!ret)
    {
      tf_call_stream_fail (self,
          TP_CALL_STATE_CHANGE_REASON_INTERNAL_ERROR,
          TP_ERROR_STR_MEDIA_STREAMING_ERROR,
          "Error setting the remote candidates: %s",
          error != NULL ? error->message : "invalid transport type");
      g_clear_error (&error);
    }

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the telepathy-bugs mailing list