20017b
From b2cf3f064b8f5efef89bb084521b61318c71781b Mon Sep 17 00:00:00 2001
20017b
From: Xinchen Hui <laruence@php.net>
20017b
Date: Thu, 29 Jan 2015 00:00:09 +0800
20017b
Subject: [PATCH] Fixed bug #68901 (use after free)
20017b
20017b
---
20017b
 NEWS                   | 3 +++
20017b
 ext/phar/phar_object.c | 2 +-
20017b
 2 files changed, 4 insertions(+), 1 deletion(-)
20017b
20017b
diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c
20017b
index 3671054..712795b 100644
20017b
--- a/ext/phar/phar_object.c
20017b
+++ b/ext/phar/phar_object.c
20017b
@@ -2210,8 +2210,8 @@ static zval *phar_rename_archive(phar_archive_data *phar, char *ext, zend_bool c
20017b
 	}
20017b
 its_ok:
20017b
 	if (SUCCESS == php_stream_stat_path(newpath, &ssb)) {
20017b
-		efree(oldpath);
20017b
 		zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "phar \"%s\" exists and must be unlinked prior to conversion", newpath);
20017b
+		efree(oldpath);
20017b
 		return NULL;
20017b
 	}
20017b
 	if (!phar->is_data) {
20017b
-- 
20017b
2.1.4
20017b