commit: 8febe8d3aae1033a3e9a63793ab46053860d18cf
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 29 13:20:26 2019 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Nov 29 13:20:26 2019 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=8febe8d3
main/qsearch: plug some minor memleaks
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
main.c | 6 +++++-
qsearch.c | 1 +
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/main.c b/main.c
index 056e09c..1f20b38 100644
--- a/main.c
+++ b/main.c
@@ -510,8 +510,11 @@ read_portage_profile(const char *profile, env_vars vars[])
* treat parent profiles as defaults, that can be overridden by
* *this* profile. */
strcpy(profile_file + profile_len, "parent");
- if (eat_file(profile_file, &buf, &buf_len) == 0)
+ if (eat_file(profile_file, &buf, &buf_len) == 0) {
+ if (buf != NULL)
+ free(buf);
return;
+ }
s = strtok_r(buf, "\n", &saveptr);
while (s) {
@@ -643,6 +646,7 @@ read_one_repos_conf(const char *repos_conf)
xarraypush_str(overlay_src, repos_conf);
}
if (main_repo && strcmp(repo, main_repo) == 0) {
+ free(main_overlay);
main_overlay = ele;
free(vars_to_read[11 /* PORTDIR */].src);
vars_to_read[11 /* PORTDIR */].src =
xstrdup(repos_conf);
diff --git a/qsearch.c b/qsearch.c
index 8245383..d6470f6 100644
--- a/qsearch.c
+++ b/qsearch.c
@@ -187,5 +187,6 @@ int qsearch_main(int argc, char **argv)
}
}
+ regfree(&state.search_expr);
return ret;
}