Skip to content

Commit

Permalink
Fix multiple leaks
Browse files Browse the repository at this point in the history
Signed-off-by: Radovan Sroka <[email protected]>
  • Loading branch information
radosroka committed Jul 19, 2023
1 parent cdb06af commit 2482193
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/library/filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,12 @@ int filter_load_file(void)
msg(LOG_ERR, "filter_load_file: paring error line: %ld, \"%s\"", line_number, line);
filter_destroy_obj(filter);
free(line);
line = NULL;
goto bad;
}
}

if (line) {
free(line);
line = NULL;
}
Expand Down
13 changes: 11 additions & 2 deletions src/library/policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* Radovan Sroka <[email protected]>
*/

#include "attr-sets.h"
#include "config.h"
#include <stdbool.h>
#include <stdio.h>
Expand Down Expand Up @@ -273,12 +274,20 @@ int load_rules(const conf_t *_config)
return 1;

FILE * f = open_file();
if (f == NULL)
if (f == NULL) {
destroy_attr_sets();
return 1;
}

int res = _load_rules(_config, f);
fclose(f);
return res;

if (res) {
destroy_attr_sets();
return 1;
}

return 0;
}

void destroy_rules(void)
Expand Down
3 changes: 0 additions & 3 deletions src/library/rules.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ int rules_create(llist *l)
l->cur = NULL;
l->cnt = 0;

if (init_attr_sets())
return 1;

return 0;
}

Expand Down

0 comments on commit 2482193

Please sign in to comment.