diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2023-08-13 17:43:36 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2023-08-13 17:43:36 -0700 |
commit | 384e50eea4ac68dda7366f5999f444e9751a511c (patch) | |
tree | b0dd504cb6c62c2e1f349e7220f8777a17960dda | |
parent | c97a8f1e6771a7c7202c40fb5127e914866cd7ed (diff) | |
download | zlib-384e50eea4ac68dda7366f5999f444e9751a511c.tar.gz zlib-384e50eea4ac68dda7366f5999f444e9751a511c.tar.bz2 zlib-384e50eea4ac68dda7366f5999f444e9751a511c.zip |
Remove TRYFREE macro from minizip.
-rw-r--r-- | contrib/minizip/unzip.c | 23 | ||||
-rw-r--r-- | contrib/minizip/zip.c | 21 |
2 files changed, 19 insertions, 25 deletions
diff --git a/contrib/minizip/unzip.c b/contrib/minizip/unzip.c index 7a35c86..366e1f8 100644 --- a/contrib/minizip/unzip.c +++ b/contrib/minizip/unzip.c | |||
@@ -111,9 +111,6 @@ | |||
111 | #ifndef ALLOC | 111 | #ifndef ALLOC |
112 | # define ALLOC(size) (malloc(size)) | 112 | # define ALLOC(size) (malloc(size)) |
113 | #endif | 113 | #endif |
114 | #ifndef TRYFREE | ||
115 | # define TRYFREE(p) { free(p);} | ||
116 | #endif | ||
117 | 114 | ||
118 | #define SIZECENTRALDIRITEM (0x2e) | 115 | #define SIZECENTRALDIRITEM (0x2e) |
119 | #define SIZEZIPLOCALHEADER (0x1e) | 116 | #define SIZEZIPLOCALHEADER (0x1e) |
@@ -380,7 +377,7 @@ local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f | |||
380 | if (uPosFound!=CENTRALDIRINVALID) | 377 | if (uPosFound!=CENTRALDIRINVALID) |
381 | break; | 378 | break; |
382 | } | 379 | } |
383 | TRYFREE(buf); | 380 | free(buf); |
384 | return uPosFound; | 381 | return uPosFound; |
385 | } | 382 | } |
386 | 383 | ||
@@ -443,7 +440,7 @@ local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib | |||
443 | if (uPosFound!=CENTRALDIRINVALID) | 440 | if (uPosFound!=CENTRALDIRINVALID) |
444 | break; | 441 | break; |
445 | } | 442 | } |
446 | TRYFREE(buf); | 443 | free(buf); |
447 | if (uPosFound == CENTRALDIRINVALID) | 444 | if (uPosFound == CENTRALDIRINVALID) |
448 | return CENTRALDIRINVALID; | 445 | return CENTRALDIRINVALID; |
449 | 446 | ||
@@ -723,7 +720,7 @@ extern int ZEXPORT unzClose(unzFile file) { | |||
723 | unzCloseCurrentFile(file); | 720 | unzCloseCurrentFile(file); |
724 | 721 | ||
725 | ZCLOSE64(s->z_filefunc, s->filestream); | 722 | ZCLOSE64(s->z_filefunc, s->filestream); |
726 | TRYFREE(s); | 723 | free(s); |
727 | return UNZ_OK; | 724 | return UNZ_OK; |
728 | } | 725 | } |
729 | 726 | ||
@@ -1384,7 +1381,7 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method, | |||
1384 | 1381 | ||
1385 | if (pfile_in_zip_read_info->read_buffer==NULL) | 1382 | if (pfile_in_zip_read_info->read_buffer==NULL) |
1386 | { | 1383 | { |
1387 | TRYFREE(pfile_in_zip_read_info); | 1384 | free(pfile_in_zip_read_info); |
1388 | return UNZ_INTERNALERROR; | 1385 | return UNZ_INTERNALERROR; |
1389 | } | 1386 | } |
1390 | 1387 | ||
@@ -1441,8 +1438,8 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method, | |||
1441 | pfile_in_zip_read_info->stream_initialised=Z_BZIP2ED; | 1438 | pfile_in_zip_read_info->stream_initialised=Z_BZIP2ED; |
1442 | else | 1439 | else |
1443 | { | 1440 | { |
1444 | TRYFREE(pfile_in_zip_read_info->read_buffer); | 1441 | free(pfile_in_zip_read_info->read_buffer); |
1445 | TRYFREE(pfile_in_zip_read_info); | 1442 | free(pfile_in_zip_read_info); |
1446 | return err; | 1443 | return err; |
1447 | } | 1444 | } |
1448 | #else | 1445 | #else |
@@ -1462,8 +1459,8 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method, | |||
1462 | pfile_in_zip_read_info->stream_initialised=Z_DEFLATED; | 1459 | pfile_in_zip_read_info->stream_initialised=Z_DEFLATED; |
1463 | else | 1460 | else |
1464 | { | 1461 | { |
1465 | TRYFREE(pfile_in_zip_read_info->read_buffer); | 1462 | free(pfile_in_zip_read_info->read_buffer); |
1466 | TRYFREE(pfile_in_zip_read_info); | 1463 | free(pfile_in_zip_read_info); |
1467 | return err; | 1464 | return err; |
1468 | } | 1465 | } |
1469 | /* windowBits is passed < 0 to tell that there is no zlib header. | 1466 | /* windowBits is passed < 0 to tell that there is no zlib header. |
@@ -1894,7 +1891,7 @@ extern int ZEXPORT unzCloseCurrentFile(unzFile file) { | |||
1894 | } | 1891 | } |
1895 | 1892 | ||
1896 | 1893 | ||
1897 | TRYFREE(pfile_in_zip_read_info->read_buffer); | 1894 | free(pfile_in_zip_read_info->read_buffer); |
1898 | pfile_in_zip_read_info->read_buffer = NULL; | 1895 | pfile_in_zip_read_info->read_buffer = NULL; |
1899 | if (pfile_in_zip_read_info->stream_initialised == Z_DEFLATED) | 1896 | if (pfile_in_zip_read_info->stream_initialised == Z_DEFLATED) |
1900 | inflateEnd(&pfile_in_zip_read_info->stream); | 1897 | inflateEnd(&pfile_in_zip_read_info->stream); |
@@ -1905,7 +1902,7 @@ extern int ZEXPORT unzCloseCurrentFile(unzFile file) { | |||
1905 | 1902 | ||
1906 | 1903 | ||
1907 | pfile_in_zip_read_info->stream_initialised = 0; | 1904 | pfile_in_zip_read_info->stream_initialised = 0; |
1908 | TRYFREE(pfile_in_zip_read_info); | 1905 | free(pfile_in_zip_read_info); |
1909 | 1906 | ||
1910 | s->pfile_in_zip_read=NULL; | 1907 | s->pfile_in_zip_read=NULL; |
1911 | 1908 | ||
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 | } |