re-use of dbprocess structure (was: Re: [freetds]stateofdbrpcsend())

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Mon Jul 12 04:33:44 EDT 2004


> 
> > Yes, this clear some things. Can you post entire code (with 
> source store
> > procedure if you can) so I can try to reproduce it ?
> 
> Attached is a stand-alone test program and stored procedure that 
> illustrates the memory leak.
> 
> Thanks.
> 

This patch should solve your problem.

Index: src/dblib/rpc.c
===================================================================
RCS file: /cvsroot/freetds/freetds/src/dblib/rpc.c,v
retrieving revision 1.28
diff -u -1 -0 -r1.28 rpc.c
--- src/dblib/rpc.c     8 Jul 2004 09:41:37 -0000       1.28
+++ src/dblib/rpc.c     12 Jul 2004 08:22:01 -0000
@@ -364,13 +364,14 @@
 param_clear(DBREMOTE_PROC_PARAM * pparam)
 {
        if (pparam == NULL)
                return;

        if (pparam->next) {
                param_clear(pparam->next);
        }

        /* free self after clearing children */
+       if (pparam->name)
+               free(pparam->name);
        free(pparam);
-       pparam = (DBREMOTE_PROC_PARAM *) NULL;
 }

freddy77



More information about the FreeTDS mailing list