summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-10-30 02:37:09 (EDT)
committer graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-10-30 02:37:09 (EDT)
commit8fe2c7a40a79c7d1b68bd00955729e94a21a0ea5 (patch)
tree393cacdeb8684d65cd64c3055ff5125d2b5c46f3
parente5cfa6dc4794e0a5bca36cabcd12a877454478db (diff)
Fix some memory leaks.
git-svn-id: http://opkg.googlecode.com/svn/trunk@229 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
-rw-r--r--libopkg/nv_pair_list.c2
-rw-r--r--libopkg/opkg.c1
-rw-r--r--libopkg/pkg_hash.c9
-rw-r--r--libopkg/void_list.c6
4 files changed, 8 insertions, 10 deletions
diff --git a/libopkg/nv_pair_list.c b/libopkg/nv_pair_list.c
index fc4cd0f..e98d718 100644
--- a/libopkg/nv_pair_list.c
+++ b/libopkg/nv_pair_list.c
@@ -41,7 +41,7 @@ void nv_pair_list_deinit(nv_pair_list_t *list)
/* malloced in nv_pair_list_append */
free(nv_pair);
pos->data = NULL;
- //free(pos);
+ free(pos);
}
void_list_deinit((void_list_t *) list);
}
diff --git a/libopkg/opkg.c b/libopkg/opkg.c
index c6a86ea..5ff0eb5 100644
--- a/libopkg/opkg.c
+++ b/libopkg/opkg.c
@@ -1089,7 +1089,6 @@ int opkg_repository_accessibility_check(opkg_t *opkg)
ret++;
}
str_list_elt_deinit(iter1);
- free(iter1);
}
free(src);
return ret;
diff --git a/libopkg/pkg_hash.c b/libopkg/pkg_hash.c
index 5b7e3dd..dc9c3d0 100644
--- a/libopkg/pkg_hash.c
+++ b/libopkg/pkg_hash.c
@@ -576,10 +576,6 @@ pkg_t *hash_insert_pkg(hash_table_t *hash, pkg_t *pkg, int set_status,opkg_conf_
if(!ab_pkg->pkgs)
ab_pkg->pkgs = pkg_vec_alloc();
- /* pkg_vec_insert_merge might munge package, but it returns an unmunged pkg */
- pkg = pkg_vec_insert_merge(ab_pkg->pkgs, pkg, set_status,conf );
- pkg->parent = ab_pkg;
-
if (buildProvides(hash, ab_pkg, pkg)<0){
fprintf(stderr, "%s : This should never happen. Report this Bug in bugzilla please \n ",__FUNCTION__);
return NULL;
@@ -595,6 +591,11 @@ pkg_t *hash_insert_pkg(hash_table_t *hash, pkg_t *pkg, int set_status,opkg_conf_
}
buildDependedUponBy(pkg, ab_pkg);
+
+ /* pkg_vec_insert_merge might munge package, but it returns an unmunged pkg */
+ pkg = pkg_vec_insert_merge(ab_pkg->pkgs, pkg, set_status,conf );
+ pkg->parent = ab_pkg;
+
return pkg;
}
diff --git a/libopkg/void_list.c b/libopkg/void_list.c
index 676e3b1..1517228 100644
--- a/libopkg/void_list.c
+++ b/libopkg/void_list.c
@@ -30,7 +30,7 @@ int void_list_elt_init(void_list_elt_t *elt, void *data)
void_list_elt_t * void_list_elt_new (void *data) {
void_list_elt_t *elt;
- /* freed in void_list_deinit */
+ /* freed in void_list_elt_deinit */
elt = calloc(1, sizeof(void_list_elt_t));
if (elt == NULL) {
fprintf(stderr, "%s: out of memory\n", __FUNCTION__);
@@ -44,6 +44,7 @@ void void_list_elt_deinit(void_list_elt_t *elt)
{
list_del_init(&elt->node);
void_list_elt_init(elt, NULL);
+ free(elt);
}
int void_list_init(void_list_t *list)
@@ -59,8 +60,6 @@ void void_list_deinit(void_list_t *list)
while (!void_list_empty(list)) {
elt = void_list_pop(list);
void_list_elt_deinit(elt);
- /* malloced in void_list_append */
- free(elt);
}
INIT_LIST_HEAD(&list->head);
}
@@ -116,7 +115,6 @@ void *void_list_remove(void_list_t *list, void_list_elt_t **iter)
*iter = list_entry(pos->node.prev, void_list_elt_t, node);
void_list_elt_deinit(pos);
- free(pos);
return old_data;
}