Fix (in a better way) CID 1491324: use after free.
authorwwp <subscript@free.fr>
Mon, 4 Oct 2021 08:39:08 +0000 (10:39 +0200)
committerwwp <subscript@free.fr>
Mon, 4 Oct 2021 08:39:08 +0000 (10:39 +0200)
src/prefs_filtering.c

index 3d8c2b31ff394755eb3c105ee02e935e89498be3..67baa4da76cb3b3f87aae0056d12ba5b06e08d9f 100644 (file)
@@ -795,13 +795,15 @@ static void delete_path(GSList ** p_filters, const gchar * path)
                                 prefixlen = destlen - pathlen;
                                 suffix = action->destination + prefixlen;
                                 
-                                if (suffix && !strncmp(path, suffix, pathlen)) {
+                                if ((suffix && !strncmp(path, suffix, pathlen)) && filtering) {
                                         filters = g_slist_remove(filters, filtering);
                                         filteringprop_free(filtering);
+                                        filtering = NULL;
                                 }
-                        } else if (strcmp(action->destination, path) == 0) {
+                        } else if ((strcmp(action->destination, path) == 0) && filtering) {
                                 filters = g_slist_remove(filters, filtering);
                                 filteringprop_free(filtering);
+                                filtering = NULL;
                         }
                 }
         }