summaryrefslogtreecommitdiffstats
path: root/0001-Fix-memory-leak-in-zip-when-encountering-empty-glob-.patch
blob: 1950f491e4b4797325cd663b0cf8e60bfcfab45f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
From 93046609eae6d4c9d57761863cc2bc590a6355e7 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Thu, 18 Sep 2025 11:08:36 +0200
Subject: [PATCH 1/4] Fix memory leak in zip when encountering empty glob
 result

From https://github.com/php/php-src/commit/216e87ad7e33fda75f33e31c36a30b04b90e4696
---
 php5/php_zip.c  | 2 --
 php7/php_zip.c  | 2 --
 php73/php_zip.c | 2 --
 php74/php_zip.c | 2 --
 php8/php_zip.c  | 2 --
 php81/php_zip.c | 2 --
 php85/php_zip.c | 2 --
 7 files changed, 14 deletions(-)

diff --git a/php5/php_zip.c b/php5/php_zip.c
index 5dda462..8d16d3b 100644
--- a/php5/php_zip.c
+++ b/php5/php_zip.c
@@ -706,7 +706,6 @@ int php_zip_glob(char *pattern, int pattern_len, long flags, zval *return_value
 			   can be used for simple glob() calls without further error
 			   checking.
 			*/
-			array_init(return_value);
 			return 0;
 		}
 #endif
@@ -715,7 +714,6 @@ int php_zip_glob(char *pattern, int pattern_len, long flags, zval *return_value
 
 	/* now catch the FreeBSD style of "no matches" */
 	if (!globbuf.gl_pathc || !globbuf.gl_pathv) {
-		array_init(return_value);
 		return 0;
 	}
 
diff --git a/php7/php_zip.c b/php7/php_zip.c
index bffed61..d962618 100644
--- a/php7/php_zip.c
+++ b/php7/php_zip.c
@@ -668,7 +668,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
 			   can be used for simple glob() calls without further error
 			   checking.
 			*/
-			array_init(return_value);
 			return 0;
 		}
 #endif
@@ -677,7 +676,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
 
 	/* now catch the FreeBSD style of "no matches" */
 	if (!globbuf.gl_pathc || !globbuf.gl_pathv) {
-		array_init(return_value);
 		return 0;
 	}
 
diff --git a/php73/php_zip.c b/php73/php_zip.c
index 0635a84..eb2c5b6 100644
--- a/php73/php_zip.c
+++ b/php73/php_zip.c
@@ -668,7 +668,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
 			   can be used for simple glob() calls without further error
 			   checking.
 			*/
-			array_init(return_value);
 			return 0;
 		}
 #endif
@@ -677,7 +676,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
 
 	/* now catch the FreeBSD style of "no matches" */
 	if (!globbuf.gl_pathc || !globbuf.gl_pathv) {
-		array_init(return_value);
 		return 0;
 	}
 
diff --git a/php74/php_zip.c b/php74/php_zip.c
index 0cd33ad..f987056 100644
--- a/php74/php_zip.c
+++ b/php74/php_zip.c
@@ -664,7 +664,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
 			   can be used for simple glob() calls without further error
 			   checking.
 			*/
-			array_init(return_value);
 			return 0;
 		}
 #endif
@@ -673,7 +672,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
 
 	/* now catch the FreeBSD style of "no matches" */
 	if (!globbuf.gl_pathc || !globbuf.gl_pathv) {
-		array_init(return_value);
 		return 0;
 	}
 
diff --git a/php8/php_zip.c b/php8/php_zip.c
index 5328c25..8129c15 100644
--- a/php8/php_zip.c
+++ b/php8/php_zip.c
@@ -674,7 +674,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
 			   can be used for simple glob() calls without further error
 			   checking.
 			*/
-			array_init(return_value);
 			return 0;
 		}
 #endif
@@ -683,7 +682,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
 
 	/* now catch the FreeBSD style of "no matches" */
 	if (!globbuf.gl_pathc || !globbuf.gl_pathv) {
-		array_init(return_value);
 		return 0;
 	}
 
diff --git a/php81/php_zip.c b/php81/php_zip.c
index ddcf47f..8bc582d 100644
--- a/php81/php_zip.c
+++ b/php81/php_zip.c
@@ -676,7 +676,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
 			   can be used for simple glob() calls without further error
 			   checking.
 			*/
-			array_init(return_value);
 			return 0;
 		}
 #endif
@@ -685,7 +684,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
 
 	/* now catch the FreeBSD style of "no matches" */
 	if (!globbuf.gl_pathc || !globbuf.gl_pathv) {
-		array_init(return_value);
 		return 0;
 	}
 
diff --git a/php85/php_zip.c b/php85/php_zip.c
index d5f7b01..604b403 100644
--- a/php85/php_zip.c
+++ b/php85/php_zip.c
@@ -628,7 +628,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
 			   can be used for simple glob() calls without further error
 			   checking.
 			*/
-			array_init(return_value);
 			return 0;
 		}
 #endif
@@ -637,7 +636,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
 
 	/* now catch the FreeBSD style of "no matches" */
 	if (!globbuf.gl_pathc || !globbuf.gl_pathv) {
-		array_init(return_value);
 		return 0;
 	}
 
-- 
2.51.0