commit b69c0c073f0d257bd49eb17691f1e9959395d66c
parent d006355369916eefff3d964d4606e183339418aa
Author: wwp <subscript@free.fr>
Date: Mon, 4 Oct 2021 10:39:08 +0200
Fix (in a better way) CID 1491324: use after free.
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/prefs_filtering.c b/src/prefs_filtering.c
@@ -776,13 +776,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;
}
}
}