From 4b4f669b62a2f1a8a27e4f55945f8f63cfc4b278 Mon Sep 17 00:00:00 2001
From: Martin Stjernholm <mast@lysator.liu.se>
Date: Wed, 13 Aug 2008 23:11:58 +0200
Subject: [PATCH] Fixed cleanup to work with the "external refs after
 unregister" debug check.

Rev: src/program.c:1.742
---
 src/program.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/program.c b/src/program.c
index 7234bcf494..5eeca88900 100644
--- a/src/program.c
+++ b/src/program.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: program.c,v 1.741 2008/08/13 18:02:02 mast Exp $
+|| $Id: program.c,v 1.742 2008/08/13 21:11:58 mast Exp $
 */
 
 #include "global.h"
@@ -8011,6 +8011,11 @@ static void run_cleanup(struct compilation *c, int delayed)
       SAFE_APPLY_MASTER("unregister",1);
       pop_stack();
 
+      /* Free the target here to avoid false alarms in the debug check
+       * below. */
+      free_program (c->target);
+      c->target = NULL;
+
 #ifdef PIKE_DEBUG
       if (p->refs > 1) {
 	/* Other programs can have indexed out constants from p, which
-- 
GitLab