Skip to content

tests: Fix warnings about unused results from g_string_free()

Philip Withnall requested to merge pwithnall/libsoup:string-free-warnings into master

GLib 2.76 emits a warning if g_string_free (_, FALSE) is used without using its return value, as it typically signifies a leak:

warning: ignoring return value of ‘g_string_free_and_steal’ declared
with attribute ‘warn_unused_result’ [-Wunused-result]

In this case, the libsoup example and test code did not leak because it had already stolen the string data from GString. That’s a bit of a layering violation (the string data briefly has two owners), so rearrange the code to fix that and silence the warning.

Signed-off-by: Philip Withnall pwithnall@endlessos.org

Merge request reports