diff options
author | Andrés <andmarti@gmail.com> | 2021-12-06 08:38:37 -0300 |
---|---|---|
committer | Andrés <andmarti@gmail.com> | 2021-12-06 08:38:37 -0300 |
commit | f3d066242521bd54270fcd4da579ae11fc805659 (patch) | |
tree | 00aa9e35dc9c668e6a3551d241c53c98b12ce46b | |
parent | febe708c17629c52f4549da7dc8b6237c2126d66 (diff) |
work on issue 637
-rw-r--r-- | src/actions/filter.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/actions/filter.c b/src/actions/filter.c index 411620d..27403be 100644 --- a/src/actions/filter.c +++ b/src/actions/filter.c @@ -216,8 +216,14 @@ void show_filters() { int free_filters() { if (filters == NULL) return -1; int i; - for (i=0; i < howmany; i++) - if (filters[i].eval != NULL) scxfree((char *) filters[i].eval); + disable_filters(); + for (i=0; i < howmany; i++) { + if (filters[i].eval != NULL) { + scxfree((char *) filters[i].eval); + filters[i].eval = NULL; + howmany--; + } + } scxfree((char *) filters); filters = NULL; return 0; @@ -230,7 +236,7 @@ int free_filters() { * \return int: -1 not removed - 0 removed */ int del_filter(int id) { - if (filters == NULL || id < 0 || id > howmany) { + if (filters == NULL || id < 0) { sc_error("Cannot delete the filter"); return -1; } @@ -238,6 +244,7 @@ int del_filter(int id) { scxfree((char *) filters[id].eval); filters[id].eval = NULL; } + howmany--; return 0; } |