mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-03 01:36:17 +01:00
gbytes: Add an assertion to placate static analysis
Otherwise `scan-build` thinks it’s possible for the `GBytes` to be double-freed, which would indeed happen if `try_steal_and_unref()` were to return `NULL` on this branch. It’s not actually possible for it to return `NULL` here though, as if `bytes->data` were `NULL`, the function would have already returned higher up. Fixes this `scan-build` failure: https://gitlab.gnome.org/GNOME/glib/-/jobs/4359929 Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
parent
e4f5c2e9c5
commit
df8592268a
@ -490,6 +490,7 @@ try_steal_and_unref (GBytes *bytes,
|
||||
{
|
||||
*size = bytes->size;
|
||||
result = (gpointer)bytes->data;
|
||||
g_assert (result != NULL); /* otherwise the case of @bytes being freed can’t be distinguished */
|
||||
g_free (bytes);
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user