summaryrefslogtreecommitdiffstats
path: root/libopkg/opkg_remove.c
diff options
context:
space:
mode:
authorticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2008-12-15 00:30:29 (EST)
committer ticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2008-12-15 00:30:29 (EST)
commit733d8409723a397b4ced39ea7aaab8bc8b4af5d9 (patch)
tree7138fbfc11577cf7d0fbae0ae7fa98a02ef63a8e /libopkg/opkg_remove.c
parent1cefade73444d4670d9ae7c06e8f9cc55492fd79 (diff)
opkg: adding the hash_table_remove API, not using yet.
Just complete the API for future usage. Clean all the entry at initial time. This reduces planty of unnecessary check. In order to prevent this kind of bug, using calloc to replace most malloc git-svn-id: http://opkg.googlecode.com/svn/trunk@160 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg/opkg_remove.c')
-rw-r--r--libopkg/opkg_remove.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libopkg/opkg_remove.c b/libopkg/opkg_remove.c
index 1debf21..3edb6de 100644
--- a/libopkg/opkg_remove.c
+++ b/libopkg/opkg_remove.c
@@ -54,7 +54,7 @@ int pkg_has_installed_dependents(opkg_conf_t *conf, abstract_pkg_t *parent_apkg,
/* if caller requested the set of installed dependents */
if (pdependents) {
int p = 0;
- abstract_pkg_t **dependents = (abstract_pkg_t **)malloc((n_installed_dependents+1)*sizeof(abstract_pkg_t *));
+ abstract_pkg_t **dependents = (abstract_pkg_t **)calloc((n_installed_dependents+1), sizeof(abstract_pkg_t *));
if ( dependents == NULL ){
fprintf(stderr,"%s Unable to allocate memory. REPORT THIS BUG IN BUGZILLA PLEASE\n", __FUNCTION__);
@@ -181,7 +181,7 @@ static int remove_autoinstalled (opkg_conf_t *conf, pkg_t *pkg)
int x = 0;
pkg_t *p;
d_str = pkg->depends_str[i];
- buffer = malloc (strlen (d_str) + 1);
+ buffer = calloc (1, strlen (d_str) + 1);
if (!buffer)
{
fprintf(stderr,"%s Unable to allocate memory.\n", __FUNCTION__);