guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Reference leak in `iprin1 ()'


From: Ludovic Courtès
Subject: [PATCH] Reference leak in `iprin1 ()'
Date: Thu, 10 Nov 2005 10:47:17 +0100
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

Hi,

Kevin Ryde <address@hidden> writes:

> I may have struck that or something similar a while back.  Mikael
> explained it was a reference held in the print data of the output
> port, or something.  Used to detect cyclic structures, or something.

Thanks: you put me on the right track!  So this issue is now gone.  :-)

Ludovic.


2005-11-10  Ludovic Courtès  <address@hidden>

        * print.c (EXIT_NESTED_DATA): Before popping from the stack,
        reset the value at its top.  This fixes a reference leak.


--- orig/libguile/print.c
+++ mod/libguile/print.c
@@ -136,7 +136,13 @@
   PUSH_REF(pstate, obj); \
 } while(0)
 
-#define EXIT_NESTED_DATA(pstate) { --pstate->top; }
+#define EXIT_NESTED_DATA(pstate)                               \
+do                                                             \
+{                                                              \
+  PSTATE_STACK_SET (pstate, pstate->top, SCM_UNDEFINED);       \
+  --pstate->top;                                               \
+}                                                              \
+while (0)
 
 SCM scm_print_state_vtable = SCM_BOOL_F;
 static SCM print_state_pool = SCM_EOL;
@@ -144,8 +150,8 @@
 
 #ifdef GUILE_DEBUG /* Used for debugging purposes */
 
-SCM_DEFINE (scm_current_pstate, "current-pstate", 0, 0, 0, 
-           (),
+SCM_DEFINE (scm_current_pstate, "current-pstate", 0, 0, 0,
+           (void),
            "Return the current-pstate -- the car of the\n"
            "@code{print_state_pool}.  @code{current-pstate} is only\n"
            "included in @code{--enable-guile-debug} builds.")




reply via email to

[Prev in Thread] Current Thread [Next in Thread]