Skip to content

Commit 44a863a

Browse files
committed
ext/phar: Do not aquire lifetime of basename parameter in phar_file_action()
This is incredibly confusing.
1 parent 8fa09cd commit 44a863a

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

ext/phar/phar_object.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char
168168

169169
switch (code) {
170170
case PHAR_MIME_PHPS:
171-
efree(basename);
172171
/* highlight source */
173172
if (entry[0] == '/') {
174173
spprintf(&name, 4096, "phar://%s%s", arch, entry);
@@ -186,7 +185,6 @@ static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char
186185
zend_bailout();
187186
case PHAR_MIME_OTHER:
188187
/* send headers, output file contents */
189-
efree(basename);
190188
ctr.line_len = spprintf((char **) &(ctr.line), 0, "Content-type: %s", mime_type);
191189
sapi_header_op(SAPI_HEADER_REPLACE, &ctr);
192190
efree((void *) ctr.line);
@@ -230,7 +228,6 @@ static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char
230228
case PHAR_MIME_PHP:
231229
if (basename) {
232230
phar_mung_server_vars(arch, entry, entry_len, basename, ru_len);
233-
efree(basename);
234231
}
235232

236233
if (entry[0] == '/') {
@@ -870,6 +867,7 @@ PHP_METHOD(Phar, webPhar)
870867
code = phar_file_type(&PHAR_G(mime_types), entry, &mime_type);
871868
}
872869
phar_file_action(phar, info, mime_type, code, entry, entry_len, fname, pt, ru, ru_len);
870+
efree(pt);
873871

874872
finish: ;
875873
#ifdef PHP_WIN32

0 commit comments

Comments
 (0)