From ad4f1c7906d16fd42feb8fd867050079aebba4dc Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Wed, 20 Feb 2008 13:39:51 +0000 Subject: [PATCH] - fix memory leaks --- src/repo_solv.c | 1 + tools/common_write.c | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/repo_solv.c b/src/repo_solv.c index fafc7f7..909b4dd 100644 --- a/src/repo_solv.c +++ b/src/repo_solv.c @@ -1375,6 +1375,7 @@ fprintf(stderr, "solv %d name %d type %d class %d\n", i, id, keys[key].type, key sat_free(parent->schemata); sat_free(parent->schemadata); sat_free(parent->keys); + sat_free(parent->location); *parent = data; } else if (data.incoredatalen || data.fp) diff --git a/tools/common_write.c b/tools/common_write.c index 749cc1b..01fdda7 100644 --- a/tools/common_write.c +++ b/tools/common_write.c @@ -92,14 +92,19 @@ tool_write(Repo *repo, const char *basename, const char *attrname) fileinfo = fileinfoa; FILE *fp = fopen (attrname, "w"); repo_write(repo, fp, keyfilter_attr, 0, fileinfo, 0); - fclose (fp); - fileinfo->location = strdup (attrname); + fclose(fp); + fileinfo->location = strdup(attrname); fileinfo++; nsubfiles = fileinfo - fileinfoa; fileinfo = fileinfoa; } repo_write(repo, stdout, keyfilter_solv, 0, fileinfo, nsubfiles); + if (fileinfo) + { + free(fileinfo->location); + free(fileinfo->keys); + } sat_free(filter); return 0; } -- 2.7.4