From: Adam Dickmeiss Date: Wed, 31 Mar 1999 11:15:37 +0000 (+0000) Subject: Fixed memory leaks in ccl_find_str and ccl_qual_rm. X-Git-Tag: YAZ.1.8~391 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=ba3b08ceb55b7448c0022892d6d013a107b26ab7;p=yaz-moved-to-github.git Fixed memory leaks in ccl_find_str and ccl_qual_rm. --- diff --git a/ccl/Makefile.in b/ccl/Makefile.in index 6b8f131..428f2a9 100644 --- a/ccl/Makefile.in +++ b/ccl/Makefile.in @@ -2,7 +2,10 @@ # Europagate, 1995 # # $Log: Makefile.in,v $ -# Revision 1.3 1998-10-28 15:10:03 adam +# Revision 1.4 1999-03-31 11:15:37 adam +# Fixed memory leaks in ccl_find_str and ccl_qual_rm. +# +# Revision 1.3 1998/10/28 15:10:03 adam # Added --with-yc option to configure. For the data1_node in data1.h: # decreased size of localdata and removed member "line" which wasn't useful. # @@ -66,7 +69,7 @@ LIBS=@LIBS@ INCLUDE=-I../z39.50 -I../include PROG=cclsh -LIB=../lib/ccl.a +LIB=../lib/libccl.a PO=cclfind.o ccltoken.o cclerrms.o cclqual.o cclptree.o cclqfile.o cclstr.o DEFS=$(INCLUDE) $(CDEFS) diff --git a/ccl/cclfind.c b/ccl/cclfind.c index b20b3cd..f8b19a6 100644 --- a/ccl/cclfind.c +++ b/ccl/cclfind.c @@ -45,7 +45,10 @@ * Europagate, 1995 * * $Log: cclfind.c,v $ - * Revision 1.10 1998-02-11 11:53:33 adam + * Revision 1.11 1999-03-31 11:15:37 adam + * Fixed memory leaks in ccl_find_str and ccl_qual_rm. + * + * Revision 1.10 1998/02/11 11:53:33 adam * Changed code so that it compiles as C++. * * Revision 1.9 1997/09/29 08:56:37 adam @@ -856,5 +859,6 @@ struct ccl_rpn_node *ccl_find_str (CCL_bibset bibset, const char *str, if (*error) *pos = cclp->error_pos - str; ccl_parser_destroy (cclp); + ccl_token_del (list); return p; } diff --git a/ccl/cclqual.c b/ccl/cclqual.c index 343d64f..0196de2 100644 --- a/ccl/cclqual.c +++ b/ccl/cclqual.c @@ -45,7 +45,10 @@ * Europagate, 1995 * * $Log: cclqual.c,v $ - * Revision 1.10 1998-07-07 15:49:40 adam + * Revision 1.11 1999-03-31 11:15:37 adam + * Fixed memory leaks in ccl_find_str and ccl_qual_rm. + * + * Revision 1.10 1998/07/07 15:49:40 adam * Added braces to avoid warning. * * Revision 1.9 1998/02/11 11:53:33 adam @@ -191,6 +194,7 @@ void ccl_qual_rm (CCL_bibset *b) free (attr); } q1 = q->next; + free (q->name); free (q); } free (*b); diff --git a/ccl/cclsh.c b/ccl/cclsh.c index 1e12be6..5f1bb83 100644 --- a/ccl/cclsh.c +++ b/ccl/cclsh.c @@ -45,7 +45,10 @@ * Europagate 1995 * * $Log: cclsh.c,v $ - * Revision 1.3 1997-04-30 08:52:07 quinn + * Revision 1.4 1999-03-31 11:15:37 adam + * Fixed memory leaks in ccl_find_str and ccl_qual_rm. + * + * Revision 1.3 1997/04/30 08:52:07 quinn * Null * * Revision 1.2 1996/10/11 15:00:25 adam @@ -111,9 +114,6 @@ int main (int argc, char **argv) { switch (argv[0][1]) { - case 'c': - ccl_case_sensitive = 0; - break; case 'd': debug = 1; break; @@ -155,23 +155,31 @@ int main (int argc, char **argv) while (1) { char buf[80]; - int error, pos; + int i, error, pos; struct ccl_rpn_node *rpn; printf ("CCLSH>"); fflush (stdout); if (!fgets (buf, 79, stdin)) break; - rpn = ccl_find_str (bibset, buf, &error, &pos); - if (error) - { - printf ("%*s^ - ", 6+pos, " "); - printf ("%s\n", ccl_err_msg (error)); - } - else + for (i = 0; i<1; i++) { - assert (rpn); - ccl_pr_tree (rpn, stdout); - putchar ('\n'); + rpn = ccl_find_str (bibset, buf, &error, &pos); + if (error) + { + printf ("%*s^ - ", 6+pos, " "); + printf ("%s\n", ccl_err_msg (error)); + } + else + { + assert (rpn); + if (i == 0) + { + ccl_pr_tree (rpn, stdout); + putchar ('\n'); + } + } + if (rpn) + ccl_rpn_delete(rpn); } } putchar ('\n');