[Fix] Fixed some memory leaks.
This commit is contained in:
parent
28cc8cfdd3
commit
c7f9fd3a79
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user