]> granicus.if.org Git - php/commitdiff
fix unlink
authorGreg Beaver <cellog@php.net>
Sun, 7 Jan 2007 19:57:26 +0000 (19:57 +0000)
committerGreg Beaver <cellog@php.net>
Sun, 7 Jan 2007 19:57:26 +0000 (19:57 +0000)
ext/phar/phar.c

index b1505c6769b134e89e110a6eeb4314a9b3be6e3d..38ffa7ddb5109bff7fd89a5d37b915ba0710bca2 100644 (file)
@@ -2248,10 +2248,14 @@ static int phar_unlink(php_stream_wrapper *wrapper, char *url, int options, php_
        }
        idata->internal_file->flags |= PHAR_ENT_DELETED;
        efree(internal_file);
-       php_url_free(resource);
        idata->internal_file = 0;
+       efree(idata);
        /* we need to "flush" the stream to save the newly deleted file on disk */
+       idata = (phar_entry_data *) emalloc(sizeof(phar_entry_data));
+       idata->fp = 0;
+       idata->phar = phar_get_archive(resource->host, strlen(resource->host), 0, 0 TSRMLS_CC);
        do_phar_flush(idata TSRMLS_CC);
+       php_url_free(resource);
        efree(idata);
        return SUCCESS;
 }