[Fix] Fixed some memory leaks.

This commit is contained in:
Allanis 2014-04-27 14:42:52 +01:00
parent 28cc8cfdd3
commit c7f9fd3a79

View File

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