From 6ffeb574c19e45a52925d4ceaeb73b3e00f429f7 Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Tue, 19 Feb 2008 18:16:09 +0000 Subject: [PATCH] - patch memory leaks --- tools/common_write.c | 1 + tools/repo_write.c | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/tools/common_write.c b/tools/common_write.c index 9673faa..749cc1b 100644 --- a/tools/common_write.c +++ b/tools/common_write.c @@ -100,5 +100,6 @@ tool_write(Repo *repo, const char *basename, const char *attrname) fileinfo = fileinfoa; } repo_write(repo, stdout, keyfilter_solv, 0, fileinfo, nsubfiles); + sat_free(filter); return 0; } diff --git a/tools/repo_write.c b/tools/repo_write.c index 5e22873..5c131c1 100644 --- a/tools/repo_write.c +++ b/tools/repo_write.c @@ -387,7 +387,6 @@ struct cbdata { struct extdata *extdata; Id *dirused; - Id *dirmap; Id vstart; }; @@ -1165,8 +1164,7 @@ for (i = 1; i < cbdata.nmykeys; i++) if (cbdata.dirused && !cbdata.dirused[0]) { /* no dirs used at all */ -fprintf(stderr, "no dirs used!\n"); - sat_free(cbdata.dirused); + cbdata.dirused = sat_free(cbdata.dirused); dirpool = 0; } if (dirpool) @@ -1243,7 +1241,6 @@ if (cbdata.dirused) if (cbdata.dirused && !cbdata.dirused[1]) cbdata.dirused[1] = 1; /* always want / entry */ dirmap = sat_calloc(dirpool->ndirs, sizeof(Id)); - dirpool_make_dirtraverse(dirpool); dirmap[0] = 0; ndirmap = traverse_dirs(dirpool, dirmap, 1, dirpool_child(dirpool, 0), cbdata.dirused); if (!cbdata.dirused) @@ -1371,6 +1368,7 @@ if (cbdata.dirused) else write_id(fp, nstrings - dirmap[i]); } + sat_free(dirmap); /* * write keys @@ -1378,7 +1376,7 @@ if (cbdata.dirused) if (setfileinfo) { fileinfo->nkeys = cbdata.nmykeys; - fileinfo->keys = sat_calloc (fileinfo->nkeys, sizeof (*fileinfo->keys)); + fileinfo->keys = sat_calloc(fileinfo->nkeys, sizeof (*fileinfo->keys)); } for (i = 1; i < cbdata.nmykeys; i++) { @@ -1548,9 +1546,18 @@ if (cbdata.dirused) for (i = 1; i < cbdata.nmykeys; i++) sat_free(cbdata.extdata[i].buf); + sat_free(cbdata.extdata); sat_free(needid); sat_free(cbdata.solvschemata); sat_free(cbdata.myschemadata); sat_free(cbdata.myschemata); + sat_free(cbdata.schema); + + sat_free(cbdata.mykeys); + sat_free(cbdata.keymap); + sat_free(cbdata.keymapstart); + sat_free(cbdata.dirused); + sat_free(cbdata.incorelen); + sat_free(repodataused); } -- 2.7.4