GNOME Bugzilla – Bug 324260
ignoring return value of 'g_list_delete_link' / 'g_list_append' (gcc 4.0.2)
Last modified: 2005-12-16 16:12:58 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:
Created attachment 56066 [details] [review] proposed patch
Created attachment 56067 [details] [review] cvs diff -up version of the patch
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?
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?
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.
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.