diff options
author | António Fernandes <antoniof@gnome.org> | 2021-01-17 23:57:15 +0000 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2021-01-18 00:08:23 +0000 |
commit | 8005046fe96803ca62662657134f12bd5659d1cf (patch) | |
tree | cfbda6f161311f4a00a87a220b3c56a3a4767942 | |
parent | 1bab20c7422dd5af08b0a2de6aa25363b8da3403 (diff) | |
download | nautilus-8005046fe96803ca62662657134f12bd5659d1cf.tar.gz |
file-operations: Don't unref NULL hash table
The SOURCE_INFO_INIT sets the hash table pointer to NULL, and we may go
out of scope before/without calling scan_sources(). So, it's wrong to
assume that .scanned_dirs_info is not NULL.
Interestingly, this didn't break the tests in either the MR or the
main branch. But it did break the move-files test in another branch
after being rebased, because that branch added an early return which
precedes scan_sources(). Thank you tests, and thank you CI!
-rw-r--r-- | src/nautilus-file-operations.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c index ed2feda10..9b721dd71 100644 --- a/src/nautilus-file-operations.c +++ b/src/nautilus-file-operations.c @@ -227,7 +227,10 @@ typedef struct static void source_info_clear (SourceInfo *source_info) { - g_hash_table_unref (source_info->scanned_dirs_info); + if (source_info->scanned_dirs_info != NULL) + { + g_hash_table_unref (source_info->scanned_dirs_info); + } } G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (SourceInfo, source_info_clear) |