From: Nathan Wagner Date: Mon, 26 Nov 2018 05:58:42 +0000 (+0000) Subject: fix possible memory leak in uncompress X-Git-Tag: v0.3.0~21 X-Git-Url: https://pd.if.org/git/?p=zpackage;a=commitdiff_plain;h=aeefcd018ce388d9a4f496994fd9961d13ba62df fix possible memory leak in uncompress --- diff --git a/lib/uncompress.c b/lib/uncompress.c index cb8fed2..bbc1adb 100644 --- a/lib/uncompress.c +++ b/lib/uncompress.c @@ -78,9 +78,11 @@ ssize_t uncompresslzma(void *buf, size_t bufsize, int out) { // that there's no trailing garbage. assert(strm->avail_in == 0); //assert(action == LZMA_FINISH); + lzma_end(strm); return bytes; } + lzma_end(strm); const char *msg; switch (ret) { case LZMA_MEM_ERROR: diff --git a/zpm-note.c b/zpm-note.c index 927f30a..33e7fa2 100644 --- a/zpm-note.c +++ b/zpm-note.c @@ -106,5 +106,8 @@ int main(int ac, char **av){ } fail = pkg.error; zpm_close(&pkg); + if (n.id) { + zpm_note_free(&n); + } return fail ? EXIT_FAILURE : EXIT_SUCCESS; } diff --git a/zpm-syncfs.c b/zpm-syncfs.c index 0b88928..59a8825 100644 --- a/zpm-syncfs.c +++ b/zpm-syncfs.c @@ -871,6 +871,12 @@ static int install_files(void *f, int ncols, char **vals, char **cols) { return conf->errabort; } +#if 0 + int64_t used, high; + used = sqlite3_memory_used()/1024/1024; + high = sqlite3_memory_highwater(0)/1024/1024; + fprintf(stderr, "memory = %ld MB / %ld MB\n", used, high); +#endif if (conf->verbose && !conf->dryrun) { fprintf(stderr, "%s '%c' %s\n", nitem.opstr, nitem.ftype, nitem.dest);