summaryrefslogtreecommitdiff
path: root/contrib/minizip/zip.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/minizip/zip.c')
-rw-r--r--contrib/minizip/zip.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/contrib/minizip/zip.c b/contrib/minizip/zip.c
index ac4e243..7facc23 100644
--- a/contrib/minizip/zip.c
+++ b/contrib/minizip/zip.c
@@ -62,9 +62,6 @@
62#ifndef ALLOC 62#ifndef ALLOC
63# define ALLOC(size) (malloc(size)) 63# define ALLOC(size) (malloc(size))
64#endif 64#endif
65#ifndef TRYFREE
66# define TRYFREE(p) {if (p) free(p);}
67#endif
68 65
69/* 66/*
70#define SIZECENTRALDIRITEM (0x2e) 67#define SIZECENTRALDIRITEM (0x2e)
@@ -204,7 +201,7 @@ local void free_datablock(linkedlist_datablock_internal* ldi) {
204 while (ldi!=NULL) 201 while (ldi!=NULL)
205 { 202 {
206 linkedlist_datablock_internal* ldinext = ldi->next_datablock; 203 linkedlist_datablock_internal* ldinext = ldi->next_datablock;
207 TRYFREE(ldi); 204 free(ldi);
208 ldi = ldinext; 205 ldi = ldinext;
209 } 206 }
210} 207}
@@ -505,7 +502,7 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
505 if (uPosFound!=0) 502 if (uPosFound!=0)
506 break; 503 break;
507 } 504 }
508 TRYFREE(buf); 505 free(buf);
509 return uPosFound; 506 return uPosFound;
510} 507}
511 508
@@ -568,7 +565,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
568 break; 565 break;
569 } 566 }
570 567
571 TRYFREE(buf); 568 free(buf);
572 if (uPosFound == 0) 569 if (uPosFound == 0)
573 return 0; 570 return 0;
574 571
@@ -802,7 +799,7 @@ local int LoadCentralDirectoryRecord(zip64_internal* pziinit) {
802 799
803 size_central_dir_to_read-=read_this; 800 size_central_dir_to_read-=read_this;
804 } 801 }
805 TRYFREE(buf_read); 802 free(buf_read);
806 } 803 }
807 pziinit->begin_pos = byte_before_the_zipfile; 804 pziinit->begin_pos = byte_before_the_zipfile;
808 pziinit->number_entry = number_entry_CD; 805 pziinit->number_entry = number_entry_CD;
@@ -876,9 +873,9 @@ extern zipFile ZEXPORT zipOpen3(const void *pathname, int append, zipcharpc* glo
876 if (err != ZIP_OK) 873 if (err != ZIP_OK)
877 { 874 {
878# ifndef NO_ADDFILEINEXISTINGZIP 875# ifndef NO_ADDFILEINEXISTINGZIP
879 TRYFREE(ziinit.globalcomment); 876 free(ziinit.globalcomment);
880# endif /* !NO_ADDFILEINEXISTINGZIP*/ 877# endif /* !NO_ADDFILEINEXISTINGZIP*/
881 TRYFREE(zi); 878 free(zi);
882 return NULL; 879 return NULL;
883 } 880 }
884 else 881 else
@@ -1885,9 +1882,9 @@ extern int ZEXPORT zipClose(zipFile file, const char* global_comment) {
1885 err = ZIP_ERRNO; 1882 err = ZIP_ERRNO;
1886 1883
1887#ifndef NO_ADDFILEINEXISTINGZIP 1884#ifndef NO_ADDFILEINEXISTINGZIP
1888 TRYFREE(zi->globalcomment); 1885 free(zi->globalcomment);
1889#endif 1886#endif
1890 TRYFREE(zi); 1887 free(zi);
1891 1888
1892 return err; 1889 return err;
1893} 1890}
@@ -1944,7 +1941,7 @@ extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHea
1944 else 1941 else
1945 retVal = ZIP_ERRNO; 1942 retVal = ZIP_ERRNO;
1946 1943
1947 TRYFREE(pNewHeader); 1944 free(pNewHeader);
1948 1945
1949 return retVal; 1946 return retVal;
1950} 1947}