From bb61b4e2022bea1f8728d18dac18239ed6931826 Mon Sep 17 00:00:00 2001 From: pixdamix Date: Thu, 29 Oct 2009 05:07:11 -0400 Subject: Fix problems in error list push_error_list() should allocate the sizeof(struct) not sizeof(pointer to struct). And add some memory deallocation in error paths found while looking at this. git-svn-id: http://opkg.googlecode.com/svn/trunk@227 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- (limited to 'libopkg/opkg_cmd.c') diff --git a/libopkg/opkg_cmd.c b/libopkg/opkg_cmd.c index 4a0410c..91976ae 100644 --- a/libopkg/opkg_cmd.c +++ b/libopkg/opkg_cmd.c @@ -143,17 +143,20 @@ opkg_cmd_t *opkg_cmd_find(const char *name) void opkg_print_error_list (opkg_conf_t *conf) { - if ( error_list ) { - reverse_error_list(&error_list); + struct errlist *err = error_list; + + if (err) { + reverse_error_list(&err); printf ("Collected errors:\n"); /* Here we print the errors collected and free the list */ - while (error_list != NULL) { - printf (" * %s", error_list->errmsg); - error_list = error_list->next; + while (err != NULL) { + printf (" * %s", err->errmsg); + err = err->next; } - free_error_list(); + + free_error_list(&error_list); } } @@ -786,6 +789,8 @@ static int opkg_list_installed_cmd(opkg_conf_t *conf, int argc, char **argv) } } + pkg_vec_free(available); + return 0; } -- cgit v0.9.1