From 96a38a1f60db194fc5b3bcbe65368d6d704e72c5 Mon Sep 17 00:00:00 2001
From: Allanis <allanis@saracraft.net>
Date: Sun, 27 Apr 2014 16:15:55 +0100
Subject: [PATCH] [Fix] Error on file not found in pack_openFromCache.

---
 src/pack.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/pack.c b/src/pack.c
index 51fb1a0..7c28b36 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -216,11 +216,13 @@ Packfile_t* pack_openFromCache(Packcache_t* cache, const char* filename) {
         file->end += file->start;
       }
 
-      break;
+      return file;
     }
   }
 
-  return file;
+  free(file);
+  WARN("File '%s' not found in packfile.", filename);
+  return NULL;
 }
 
 /**