summaryrefslogtreecommitdiffstats
path: root/redis-igbinary.patch
blob: 6af75385d431c025bef691e917d169e0e77f03d9 (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
From aecfbfd650d6b504193d48f82a4a170ce3ce4cd6 Mon Sep 17 00:00:00 2001
From: Remi Collet <fedora@famillecollet.com>
Date: Fri, 3 Oct 2014 19:19:33 +0200
Subject: [PATCH] Fix segfault with igbinary, fix #341

---
 library.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/library.c b/library.c
index 40d43fa..3e91e93 100644
--- a/library.c
+++ b/library.c
@@ -1646,11 +1646,12 @@ redis_unserialize(RedisSock *redis_sock, const char *val, int val_len, zval **re
 #ifdef HAVE_REDIS_IGBINARY
 			if(!*return_value) {
 				MAKE_STD_ZVAL(*return_value);
+				rv_free = 1;
 			}
 			if(igbinary_unserialize((const uint8_t *)val, (size_t)val_len, return_value TSRMLS_CC) == 0) {
 				return 1;
 			}
-			efree(*return_value);
+			if(rv_free==1) efree(*return_value);
 #endif
 			return 0;
 			break;