b8c914
From e7e69c85c7e8e0cb75b831e606ad4f26f18b11ff Mon Sep 17 00:00:00 2001
b8c914
From: Nicolas R <atoomic@cpan.org>
b8c914
Date: Mon, 31 Oct 2016 11:53:17 -0600
b8c914
Subject: [PATCH] Avoid a segfault when untying an object
b8c914
MIME-Version: 1.0
b8c914
Content-Type: text/plain; charset=UTF-8
b8c914
Content-Transfer-Encoding: 8bit
b8c914
b8c914
Check if the tied object has a stash set
b8c914
before calling UNTIE method.
b8c914
b8c914
Signed-off-by: Petr Písař <ppisar@redhat.com>
b8c914
---
b8c914
 pp_sys.c | 2 +-
b8c914
 1 file changed, 1 insertion(+), 1 deletion(-)
b8c914
b8c914
diff --git a/pp_sys.c b/pp_sys.c
b8c914
index 672e7de08e..6d4dd86b7f 100644
b8c914
--- a/pp_sys.c
b8c914
+++ b/pp_sys.c
b8c914
@@ -1017,7 +1017,7 @@ PP(pp_untie)
b8c914
 
b8c914
     if ((mg = SvTIED_mg(sv, how))) {
b8c914
 	SV * const obj = SvRV(SvTIED_obj(sv, mg));
b8c914
-        if (obj) {
b8c914
+        if (obj && SvSTASH(obj)) {
b8c914
 	    GV * const gv = gv_fetchmethod_autoload(SvSTASH(obj), "UNTIE", FALSE);
b8c914
 	    CV *cv;
b8c914
 	    if (gv && isGV(gv) && (cv = GvCV(gv))) {
b8c914
-- 
b8c914
2.13.6
b8c914