6b7353
diff -up expect5.45/expect.c.orig expect5.45/expect.c
6b7353
--- expect5.45/expect.c.orig	2013-10-02 13:16:31.462430482 +0200
6b7353
+++ expect5.45/expect.c	2013-10-02 13:17:18.420599495 +0200
6b7353
@@ -185,9 +185,9 @@ free_ecase(
6b7353
 {
6b7353
     if (ec->i_list->duration == EXP_PERMANENT) {
6b7353
 	if (ec->pat)  { Tcl_DecrRefCount(ec->pat); }
6b7353
-	if (ec->gate) { Tcl_DecrRefCount(ec->gate); }
6b7353
 	if (ec->body) { Tcl_DecrRefCount(ec->body); }
6b7353
     }
6b7353
+    if (ec->gate) { Tcl_DecrRefCount(ec->gate); }
6b7353
 
6b7353
     if (free_ilist) {
6b7353
 	ec->i_list->ecount--;