gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r1731 - gnunet-gtk/src/plugins/fs


From: grothoff
Subject: [GNUnet-SVN] r1731 - gnunet-gtk/src/plugins/fs
Date: Wed, 17 Aug 2005 21:33:53 -0700 (PDT)

Author: grothoff
Date: 2005-08-17 21:33:52 -0700 (Wed, 17 Aug 2005)
New Revision: 1731

Modified:
   gnunet-gtk/src/plugins/fs/collection.c
   gnunet-gtk/src/plugins/fs/download.c
   gnunet-gtk/src/plugins/fs/namespace.c
Log:
fixing memory leaks from 686 and then some

Modified: gnunet-gtk/src/plugins/fs/collection.c
===================================================================
--- gnunet-gtk/src/plugins/fs/collection.c      2005-08-18 04:12:56 UTC (rev 
1730)
+++ gnunet-gtk/src/plugins/fs/collection.c      2005-08-18 04:33:52 UTC (rev 
1731)
@@ -173,6 +173,7 @@
 }
 
 void fs_collection_stop() {
+  /* nothing to do */
 }
 
 /* end of collection.c */

Modified: gnunet-gtk/src/plugins/fs/download.c
===================================================================
--- gnunet-gtk/src/plugins/fs/download.c        2005-08-18 04:12:56 UTC (rev 
1730)
+++ gnunet-gtk/src/plugins/fs/download.c        2005-08-18 04:33:52 UTC (rev 
1731)
@@ -497,10 +497,11 @@
 }
 
 
-
 void fs_download_stop() {
   GtkTreeIter iter;
   struct ECRS_URI * u;
+  struct ECRS_MetaData * m;
+  DownloadList * pos;
 
   /* free URIs in summary model */
   if (! gtk_tree_model_get_iter_first(GTK_TREE_MODEL(summary),
@@ -517,10 +518,36 @@
                       -1);  
     if (u != NULL)
       ECRS_freeUri(u);
-    /* FIXME:
-       also free DOWNLOAD_TREEPATH! */
   } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(summary),
                                    &iter));
+  while (head != NULL) {
+    pos = head->next;
+    ECRS_freeUri(head->uri);
+    FREE(head->filename);
+    gtk_tree_row_reference_free(head->rr);
+    if (gtk_tree_model_get_iter_first(head->model,
+                                     &iter)) {
+      do {
+       gtk_tree_model_get(head->model,
+                          &iter,
+                          SEARCH_URI, &u,
+                          SEARCH_META, &m,
+                          -1);
+       gtk_tree_store_set(GTK_TREE_STORE(head->model),
+                          &iter,
+                          SEARCH_URI, NULL,
+                          SEARCH_META, NULL,
+                          -1);  
+       if (u != NULL)
+         ECRS_freeUri(u);
+       if (m != NULL)
+         ECRS_freeMetaData(m);
+      } while (gtk_tree_model_iter_next(head->model,
+                                       &iter));
+    }
+    FREE(head);
+    head = pos;
+  }
 }
 
 

Modified: gnunet-gtk/src/plugins/fs/namespace.c
===================================================================
--- gnunet-gtk/src/plugins/fs/namespace.c       2005-08-18 04:12:56 UTC (rev 
1730)
+++ gnunet-gtk/src/plugins/fs/namespace.c       2005-08-18 04:33:52 UTC (rev 
1731)
@@ -868,8 +868,40 @@
 }
 
 void fs_namespace_stop() {
-  /* FIXME: free memory! */
+  NamespaceList * pos;
+  GtkTreeIter iter;
+  struct ECRS_URI * u;
+  struct ECRS_MetaData * m;
 
+  while (head != NULL) {
+    pos = head->next;
+    FREE(head->name);
+    ECRS_freeMetaData(head->meta);
+
+  if (gtk_tree_model_get_iter_first(head->model,
+                                   &iter)) {
+      do {
+       gtk_tree_model_get(head->model,
+                          &iter,
+                          IN_NAMESPACE_URI, &u,
+                          IN_NAMESPACE_META, &m,
+                          -1);
+       gtk_list_store_set(GTK_LIST_STORE(head->model),
+                          &iter,
+                          IN_NAMESPACE_URI, NULL,
+                          IN_NAMESPACE_META, NULL,
+                          -1);  
+       if (u != NULL)
+         ECRS_freeUri(u);
+       if (m != NULL)
+         ECRS_freeMetaData(m);
+      } while (gtk_tree_model_iter_next(head->model,
+                                       &iter));
+    }
+    FREE(head);
+    head = pos;
+  }
+
   delCronJob(&updateContentList,
             5 * cronMINUTES,
             NULL);





reply via email to

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