mirror of https://github.com/madler/zlib
Fix reported memory leak (strdup without free)
Clean up compiler warnings
This commit is contained in:
parent
4a090adef8
commit
652939dd21
|
@ -14,26 +14,33 @@
|
||||||
|
|
||||||
#include "zlib.h"
|
#include "zlib.h"
|
||||||
|
|
||||||
|
#ifdef __unix__
|
||||||
|
# ifndef unix
|
||||||
|
# define unix 1
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef unix
|
#ifdef unix
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
|
# include <sys/stat.h>
|
||||||
#else
|
#else
|
||||||
# include <direct.h>
|
# include <direct.h>
|
||||||
# include <io.h>
|
# include <io.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
# ifndef F_OK
|
# ifndef F_OK
|
||||||
# define F_OK 0
|
# define F_OK 0
|
||||||
# endif
|
# endif
|
||||||
# define mkdir(dirname,mode) _mkdir(dirname)
|
# define mkdir(dirname,mode) _mkdir(dirname)
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
# define access(path,mode) _access(path,mode)
|
# define access(path,mode) _access(path,mode)
|
||||||
# define chmod(path,mode) _chmod(path,mode)
|
# define chmod(path,mode) _chmod(path,mode)
|
||||||
# define strdup(str) _strdup(str)
|
# define strdup(str) _strdup(str)
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# include <utime.h>
|
# include <utime.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -277,6 +284,7 @@ void restore_attr(struct attr_item **list)
|
||||||
chmod(item->fname,item->mode);
|
chmod(item->fname,item->mode);
|
||||||
prev = item;
|
prev = item;
|
||||||
item = item->next;
|
item = item->next;
|
||||||
|
free(prev->fname);
|
||||||
free(prev);
|
free(prev);
|
||||||
}
|
}
|
||||||
*list = NULL;
|
*list = NULL;
|
||||||
|
@ -608,7 +616,7 @@ int main(int argc,char **argv)
|
||||||
int action = TGZ_EXTRACT;
|
int action = TGZ_EXTRACT;
|
||||||
int arg = 1;
|
int arg = 1;
|
||||||
char *TGZfile;
|
char *TGZfile;
|
||||||
gzFile *f;
|
gzFile f;
|
||||||
|
|
||||||
prog = strrchr(argv[0],'\\');
|
prog = strrchr(argv[0],'\\');
|
||||||
if (prog == NULL)
|
if (prog == NULL)
|
||||||
|
|
Loading…
Reference in New Issue