After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 324260 - ignoring return value of 'g_list_delete_link' / 'g_list_append' (gcc 4.0.2)
ignoring return value of 'g_list_delete_link' / 'g_list_append' (gcc 4.0.2)
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
0.8.11
Other All
: Normal major
: 0.8.12
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2005-12-16 12:06 UTC by Christian Kirbach
Modified: 2005-12-16 16:12 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14


Attachments
proposed patch (1.12 KB, patch)
2005-12-16 13:32 UTC, Christian Kirbach
none Details | Review
cvs diff -up version of the patch (1.66 KB, patch)
2005-12-16 13:57 UTC, Christian Kirbach
none Details | Review
revised patch, cleaning more similar errors (2.61 KB, patch)
2005-12-16 15:13 UTC, Christian Kirbach
committed Details | Review

Description Christian Kirbach 2005-12-16 12:06:43 UTC
Please describe the problem:
gstspider.c: In function 'gst_spider_identity_unplug':
gstspider.c:532: warning: ignoring return value of 'g_list_delete_link', 
declared with attribute warn_unused_result
gstspider.c: In function 'gst_spider_create_and_plug':
gstspider.c:564: warning: ignoring return value of 'g_list_delete_link', 
declared with attribute warn_unused_result
make[4]: *** [libgstspider_la-gstspider.lo] Error 1

Steps to reproduce:
1. autogen and compile (gcc 4.0.2)
2. 
3. 


Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 Christian Kirbach 2005-12-16 13:32:34 UTC
Created attachment 56066 [details] [review]
proposed patch
Comment 2 Christian Kirbach 2005-12-16 13:57:05 UTC
Created attachment 56067 [details] [review]
cvs diff -up version of the patch
Comment 3 Tim-Philipp Müller 2005-12-16 14:07:14 UTC
Isn't the first chunk a bit dodgy anyway?

void
gst_spider_identity_unplug (GstSpiderIdentity * ident)
{
  GstSpider *spider = (GstSpider *) GST_OBJECT_PARENT (ident);
  GList *list;

  for (list = spider->links; list; list = list->next) {
    GstSpiderConnection *conn = list->data;

    if (conn->src == ident) {
      spider->links = g_list_delete_link (spider->links, list);
      gst_spider_link_destroy (conn);
    }
  }
  ident->plugged = FALSE;
}


so g_list_delete_link() removes the link 'list' from the list and frees it, but
then the loop continues with list = list->next accessing the already free'd link
node, no?

Maybe there should be an additional list = spider->links; or  break;  in there?

Comment 4 Christian Kirbach 2005-12-16 14:44:37 UTC
so, the question is: can the list item appear several times or only once, i.e. 
should the search be aborted or continued after it detects an item that is to be 
removed?
Comment 5 Christian Kirbach 2005-12-16 15:13:51 UTC
Created attachment 56074 [details] [review]
revised patch, cleaning more similar errors

Assuming that the _unplug() function only acts on one list entry and then
returns.
Fixes other similar gcc4 warnings I came across.
Comment 6 Tim-Philipp Müller 2005-12-16 16:12:58 UTC
Actually, that _unplug() function isn't even used, so I've just #ifdef'ed it out ;)

2005-12-16  Christian Kirbach  <Christian.Kirbach@student.uni-siegen.de>

        Reviewed by: Tim-Philipp Muller  <tim at centricular dot net>

        * gst/autoplug/gstspider.c: (gst_spider_identity_unplug),
          (gst_spider_create_and_plug):
        * gst/elements/gstbufferstore.c: (gst_buffer_store_add_buffer_func):
           Do not silently discard return values of g_list_delete_link()
           and g_list_append(). This would trigger gcc4 warnings that
           are treated as errors in CVS builds (fixes: #324260). Also
           ifdef out unused function while we are at it.