From c7f9fd3a79d420dd98aef180c2abd03487e940e6 Mon Sep 17 00:00:00 2001 From: Allanis Date: Sun, 27 Apr 2014 14:42:52 +0100 Subject: [PATCH] [Fix] Fixed some memory leaks. --- src/pack.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pack.c b/src/pack.c index ac38eda..51fb1a0 100644 --- a/src/pack.c +++ b/src/pack.c @@ -170,6 +170,7 @@ void pack_closeCache(Packcache_t* cache) { free(cache->index); free(cache->start); } + free(cache); } /** @@ -769,6 +770,8 @@ const char** pack_listfilesCached(Packcache_t* cache, uint32_t* nfiles) { */ int pack_close(Packfile_t* file) { int i; + + /* Close files. */ #ifdef _POSIX_SOURCE i = close(file->fd); #else @@ -777,6 +780,10 @@ int pack_close(Packfile_t* file) { else i = fclose(file->fp); #endif + + /* Free memory. */ + free(file); + return (i) ? -1 : 0; }