1 |
commit: 8febe8d3aae1033a3e9a63793ab46053860d18cf |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Nov 29 13:20:26 2019 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Nov 29 13:20:26 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=8febe8d3 |
7 |
|
8 |
main/qsearch: plug some minor memleaks |
9 |
|
10 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
11 |
|
12 |
main.c | 6 +++++- |
13 |
qsearch.c | 1 + |
14 |
2 files changed, 6 insertions(+), 1 deletion(-) |
15 |
|
16 |
diff --git a/main.c b/main.c |
17 |
index 056e09c..1f20b38 100644 |
18 |
--- a/main.c |
19 |
+++ b/main.c |
20 |
@@ -510,8 +510,11 @@ read_portage_profile(const char *profile, env_vars vars[]) |
21 |
* treat parent profiles as defaults, that can be overridden by |
22 |
* *this* profile. */ |
23 |
strcpy(profile_file + profile_len, "parent"); |
24 |
- if (eat_file(profile_file, &buf, &buf_len) == 0) |
25 |
+ if (eat_file(profile_file, &buf, &buf_len) == 0) { |
26 |
+ if (buf != NULL) |
27 |
+ free(buf); |
28 |
return; |
29 |
+ } |
30 |
|
31 |
s = strtok_r(buf, "\n", &saveptr); |
32 |
while (s) { |
33 |
@@ -643,6 +646,7 @@ read_one_repos_conf(const char *repos_conf) |
34 |
xarraypush_str(overlay_src, repos_conf); |
35 |
} |
36 |
if (main_repo && strcmp(repo, main_repo) == 0) { |
37 |
+ free(main_overlay); |
38 |
main_overlay = ele; |
39 |
free(vars_to_read[11 /* PORTDIR */].src); |
40 |
vars_to_read[11 /* PORTDIR */].src = xstrdup(repos_conf); |
41 |
|
42 |
diff --git a/qsearch.c b/qsearch.c |
43 |
index 8245383..d6470f6 100644 |
44 |
--- a/qsearch.c |
45 |
+++ b/qsearch.c |
46 |
@@ -187,5 +187,6 @@ int qsearch_main(int argc, char **argv) |
47 |
} |
48 |
} |
49 |
|
50 |
+ regfree(&state.search_expr); |
51 |
return ret; |
52 |
} |