Leak in MiniZip

I'm using MiniZip to unzip a file in an iPhone project. Everything works fine but i get a leak in instruments in the MiniZip code on this line :

unzip.c line 493

return (unzFile)s;

I understand that the var allocated with ALLOC is returned and not deallocated. In objective-C i would simply do an autorelease, but how can i achieve that in plain C ?

Thanks, Vincent.


The caller of that method is responsible for s and must free() it when it is no longer required to avoid the memory leak. This is the convention in C.

You would have to tie in a 3rd-party GC library, perhaps something like Hans Boehm's GC for C/C++. However, my suggestion would be to just free the memory when it is appropriate on your own. You'll run into less hassles that way.

Need Your Help

Non-Trivial Data-Query in Grails

sql hibernate grails groovy gorm

imagine the following problem in grails

How can I make an array a parameter of a function in C++?

c++ encryption hash

I have a function in a program I am writing for my school science fair, and what it needs to do is take in an array as a parameter, encrypt the values of the array, and store the encrypted values i...