Fixed memory leaks in ccl_find_str and ccl_qual_rm.
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 31 Mar 1999 11:15:37 +0000 (11:15 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 31 Mar 1999 11:15:37 +0000 (11:15 +0000)
ccl/Makefile.in
ccl/cclfind.c
ccl/cclqual.c
ccl/cclsh.c

index 6b8f131..428f2a9 100644 (file)
@@ -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)
 
index b20b3cd..f8b19a6 100644 (file)
  * 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;
 }
index 343d64f..0196de2 100644 (file)
  * 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);
index 1e12be6..5f1bb83 100644 (file)
  * 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');