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 762689 - warnings due to soup_uri_free called on null uri
warnings due to soup_uri_free called on null uri
Status: RESOLVED FIXED
Product: gnome-software
Classification: Applications
Component: General
3.19.x
Other Linux
: Normal normal
: ---
Assigned To: GNOME Software maintainer(s)
GNOME Software maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2016-02-25 16:47 UTC by Sebastien Bacher
Modified: 2016-08-15 08:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
that fixes the warning (855 bytes, patch)
2016-02-26 12:31 UTC, Sebastien Bacher
none Details | Review

Description Sebastien Bacher 2016-02-25 16:47:04 UTC
using current git, when screenshot fails to load (which is the currently the case on debian/ubuntu due to some appstream-glib issue) those warnings are displayed

  • #0 g_log
    at /build/glib2.0-Qx2vEO/glib2.0-2.47.6/./glib/gmessages.c line 1114
  • #1 g_return_if_fail_warning
    at /build/glib2.0-Qx2vEO/glib2.0-2.47.6/./glib/gmessages.c line 1133
  • #2 soup_uri_free
    at soup-uri.c line 691
  • #3 gs_screenshot_image_load_async
    at gs-screenshot-image.c line 440
  • #4 gs_shell_details_refresh_screenshots
    at gs-shell-details.c line 479
  • #5 gs_shell_details_app_refine_cb
    at gs-shell-details.c line 1113
  • #6 g_task_return_now
    at /build/glib2.0-Qx2vEO/glib2.0-2.47.6/./gio/gtask.c line 1107
  • #7 complete_in_idle_cb
    at /build/glib2.0-Qx2vEO/glib2.0-2.47.6/./gio/gtask.c line 1121
  • #8 g_idle_dispatch
    at /build/glib2.0-Qx2vEO/glib2.0-2.47.6/./glib/gmain.c line 5441

Comment 1 Sebastien Bacher 2016-02-25 16:50:32 UTC
the backtrace is a bit confusing, the error displayed is "screenshot not valid" which would hit the warning on l424 because base_uri is null, unsure how it can go to line 440 in this case...
Comment 2 Richard Hughes 2016-02-26 09:55:07 UTC
I'm also confused about that; does valgrind spot anything at runtim?
Comment 3 Sebastien Bacher 2016-02-26 11:55:25 UTC
Nothing from valgrind, but I added print-type debugging in the code, it's the l424 call which gives the warning

"	/* download file */
	g_debug ("downloading %s to %s", url, ssimg->filename);
	base_uri = soup_uri_new (url);
	if (base_uri == NULL || !SOUP_URI_VALID_FOR_HTTP (base_uri)) {
		/* TRANSLATORS: this is when we try to download a screenshot
		 * that was not a valid URL */
		gs_screenshot_image_set_error (ssimg, _("Screenshot not valid"));
		soup_uri_free (base_uri);
		return;
	}"

the url is invalid (due to https://github.com/hughsie/appstream-glib/issues/70) so base_uri is null, the code should probably be changed to 

if(base_uri)
    soup_uri_free (base_uri);
Comment 4 Sebastien Bacher 2016-02-26 11:57:38 UTC
(I'm going to attach a patch with the suggested change after testing it)
Comment 5 Sebastien Bacher 2016-02-26 12:31:14 UTC
Created attachment 322454 [details] [review]
that fixes the warning
Comment 6 Richard Hughes 2016-08-15 08:34:43 UTC
commit 10e988f848441fdf55362a15bf10fcd6b047eeb8
Author: Richard Hughes <richard@hughsie.com>
Date:   Mon Aug 15 09:34:17 2016 +0100

    trivial: Use g_autoptr() for the SoupURI
    
    The soup_uri_free() function is not NULL safe.
    
    Resolves: https://bugzilla.gnome.org/show_bug.cgi?id=762689