From: Michael Schroeder Date: Mon, 18 Feb 2008 21:40:07 +0000 (+0000) Subject: - free repodata memory X-Git-Tag: BASE-SuSE-Code-12_1-Branch~895 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fc86ffe55f16b5fc592313ecec87b6e81ab17392;p=platform%2Fupstream%2Flibsolv.git - free repodata memory --- diff --git a/src/repo.c b/src/repo.c index bb3043e..a0b3b84 100644 --- a/src/repo.c +++ b/src/repo.c @@ -57,6 +57,10 @@ repo_create(Pool *pool, const char *name) static void repo_freedata(Repo *repo) { + int i; + for (i = 0; i < repo->nrepodata; i++) + repodata_free(repo->repodata + i); + sat_free(repo->repodata); sat_free(repo->idarraydata); sat_free(repo->rpmdbid); sat_free((char *)repo->name); diff --git a/src/repodata.c b/src/repodata.c index e1ee942..40cd599 100644 --- a/src/repodata.c +++ b/src/repodata.c @@ -32,6 +32,39 @@ extern unsigned int unchecked_decompress_buf (const unsigned char *in, unsigned char *out, unsigned int out_len); + +void +repodata_free(Repodata *data) +{ + sat_free(data->keys); + sat_free(data->schemata); + sat_free(data->schemadata); + + sat_free(data->spool.strings); + sat_free(data->spool.stringspace); + sat_free(data->spool.stringhashtbl); + + sat_free(data->dirpool.dirs); + sat_free(data->dirpool.dirtraverse); + + sat_free(data->incoredata); + sat_free(data->incoreoffset); + sat_free(data->verticaloffset); + + sat_free(data->blob_store); + sat_free(data->pages); + sat_free(data->mapped); + + sat_free(data->vincore); + + sat_free(data->attrs); + sat_free(data->attrdata); + sat_free(data->attriddata); + + if (data->fp) + fclose(data->fp); +} + static unsigned char * data_read_id(unsigned char *dp, Id *idp) { diff --git a/src/repodata.h b/src/repodata.h index fee6f38..afa3d9c 100644 --- a/src/repodata.h +++ b/src/repodata.h @@ -119,6 +119,7 @@ const char *repodata_lookup_str(Repodata *data, Id entry, Id keyid); int repodata_lookup_num(Repodata *data, Id entry, Id keyid, unsigned *value); void repodata_extend(Repodata *data, Id p); +void repodata_free(Repodata *data); void repodata_set_id(Repodata *data, Id entry, Id keyname, Id id); void repodata_set_num(Repodata *data, Id entry, Id keyname, Id num);