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;
 }