20017b
From bdfe457a2c1b47209e32783b3a6447e81baf179a Mon Sep 17 00:00:00 2001
20017b
From: Stanislav Malyshev <stas@php.net>
20017b
Date: Mon, 16 Feb 2015 06:50:10 +0100
20017b
Subject: [PATCH] Port for for bug #68552
20017b
20017b
---
20017b
 NEWS                  | 6 ++++++
20017b
 ext/enchant/enchant.c | 7 +++----
20017b
 2 files changed, 9 insertions(+), 4 deletions(-)
20017b
20017b
diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c
20017b
index 6de2fea..0eb8144 100644
20017b
--- a/ext/enchant/enchant.c
20017b
+++ b/ext/enchant/enchant.c
20017b
@@ -550,13 +550,12 @@ PHP_FUNCTION(enchant_broker_request_dict)
20017b
 
20017b
 	d = enchant_broker_request_dict(pbroker->pbroker, (const char *)tag);
20017b
 	if (d) {
20017b
+		pos = pbroker->dictcnt++;
20017b
 		if (pbroker->dictcnt) {
20017b
 			pbroker->dict = (enchant_dict **)erealloc(pbroker->dict, sizeof(enchant_dict *) * pbroker->dictcnt);
20017b
-			pos = pbroker->dictcnt++;
20017b
 		} else {
20017b
 			pbroker->dict = (enchant_dict **)emalloc(sizeof(enchant_dict *));
20017b
 			pos = 0;
20017b
-			pbroker->dictcnt++;
20017b
 		}
20017b
 
20017b
 		dict = pbroker->dict[pos] = (enchant_dict *)emalloc(sizeof(enchant_dict));
20017b
@@ -607,14 +606,14 @@ PHP_FUNCTION(enchant_broker_request_pwl_dict)
20017b
 
20017b
 	d = enchant_broker_request_pwl_dict(pbroker->pbroker, (const char *)pwl);
20017b
 	if (d) {
20017b
+		pos = pbroker->dictcnt++;
20017b
 		if (pbroker->dictcnt) {
20017b
-			pos = pbroker->dictcnt++;
20017b
 			pbroker->dict = (enchant_dict **)erealloc(pbroker->dict, sizeof(enchant_dict *) * pbroker->dictcnt);
20017b
 		} else {
20017b
 			pbroker->dict = (enchant_dict **)emalloc(sizeof(enchant_dict *));
20017b
 			pos = 0;
20017b
-			pbroker->dictcnt++;
20017b
 		}
20017b
+
20017b
 		dict = pbroker->dict[pos] = (enchant_dict *)emalloc(sizeof(enchant_dict));
20017b
 		dict->id = pos;
20017b
 		dict->pbroker = pbroker;
20017b
-- 
20017b
2.1.4
20017b