mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
glocalfile: Assert against a potential NULL pointer dereference
This was confusing some static analysis. Through canonicalize_filename() at construction time, we guaranteed that ->filename is canonical and absolute, so g_path_skip_root() should never fail. https://bugzilla.gnome.org/show_bug.cgi?id=731988
This commit is contained in:
parent
28dcafa09b
commit
d09c219696
@ -503,8 +503,11 @@ g_local_file_get_parent (GFile *file)
|
||||
char *dirname;
|
||||
GFile *parent;
|
||||
|
||||
/* Check for root */
|
||||
/* Check for root; local->filename is guaranteed to be absolute, so
|
||||
* g_path_skip_root() should never return NULL. */
|
||||
non_root = g_path_skip_root (local->filename);
|
||||
g_assert (non_root != NULL);
|
||||
|
||||
if (*non_root == 0)
|
||||
return NULL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user