From: Michael Schroeder Date: Wed, 20 Feb 2008 13:39:51 +0000 (+0000) Subject: - fix memory leaks X-Git-Tag: BASE-SuSE-Code-12_1-Branch~308^2~569 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad4f1c7906d16fd42feb8fd867050079aebba4dc;p=thirdparty%2Flibsolv.git - fix memory leaks --- diff --git a/src/repo_solv.c b/src/repo_solv.c index fafc7f7a..909b4dd5 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 749cc1be..01fdda73 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; }