Skip to content

Commit 9304660

Browse files
committed
Fix memory leak in zip when encountering empty glob result
From php/php-src@216e87a
1 parent 1122e54 commit 9304660

7 files changed

Lines changed: 0 additions & 14 deletions

File tree

php5/php_zip.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,6 @@ int php_zip_glob(char *pattern, int pattern_len, long flags, zval *return_value
706706
can be used for simple glob() calls without further error
707707
checking.
708708
*/
709-
array_init(return_value);
710709
return 0;
711710
}
712711
#endif
@@ -715,7 +714,6 @@ int php_zip_glob(char *pattern, int pattern_len, long flags, zval *return_value
715714

716715
/* now catch the FreeBSD style of "no matches" */
717716
if (!globbuf.gl_pathc || !globbuf.gl_pathv) {
718-
array_init(return_value);
719717
return 0;
720718
}
721719

php7/php_zip.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
668668
can be used for simple glob() calls without further error
669669
checking.
670670
*/
671-
array_init(return_value);
672671
return 0;
673672
}
674673
#endif
@@ -677,7 +676,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
677676

678677
/* now catch the FreeBSD style of "no matches" */
679678
if (!globbuf.gl_pathc || !globbuf.gl_pathv) {
680-
array_init(return_value);
681679
return 0;
682680
}
683681

php73/php_zip.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
668668
can be used for simple glob() calls without further error
669669
checking.
670670
*/
671-
array_init(return_value);
672671
return 0;
673672
}
674673
#endif
@@ -677,7 +676,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
677676

678677
/* now catch the FreeBSD style of "no matches" */
679678
if (!globbuf.gl_pathc || !globbuf.gl_pathv) {
680-
array_init(return_value);
681679
return 0;
682680
}
683681

php74/php_zip.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
664664
can be used for simple glob() calls without further error
665665
checking.
666666
*/
667-
array_init(return_value);
668667
return 0;
669668
}
670669
#endif
@@ -673,7 +672,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
673672

674673
/* now catch the FreeBSD style of "no matches" */
675674
if (!globbuf.gl_pathc || !globbuf.gl_pathv) {
676-
array_init(return_value);
677675
return 0;
678676
}
679677

php8/php_zip.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
674674
can be used for simple glob() calls without further error
675675
checking.
676676
*/
677-
array_init(return_value);
678677
return 0;
679678
}
680679
#endif
@@ -683,7 +682,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
683682

684683
/* now catch the FreeBSD style of "no matches" */
685684
if (!globbuf.gl_pathc || !globbuf.gl_pathv) {
686-
array_init(return_value);
687685
return 0;
688686
}
689687

php81/php_zip.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
676676
can be used for simple glob() calls without further error
677677
checking.
678678
*/
679-
array_init(return_value);
680679
return 0;
681680
}
682681
#endif
@@ -685,7 +684,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
685684

686685
/* now catch the FreeBSD style of "no matches" */
687686
if (!globbuf.gl_pathc || !globbuf.gl_pathv) {
688-
array_init(return_value);
689687
return 0;
690688
}
691689

php85/php_zip.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
628628
can be used for simple glob() calls without further error
629629
checking.
630630
*/
631-
array_init(return_value);
632631
return 0;
633632
}
634633
#endif
@@ -637,7 +636,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
637636

638637
/* now catch the FreeBSD style of "no matches" */
639638
if (!globbuf.gl_pathc || !globbuf.gl_pathv) {
640-
array_init(return_value);
641639
return 0;
642640
}
643641

0 commit comments

Comments
 (0)