summaryrefslogtreecommitdiffstats
path: root/libopkg/pkg_parse.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/pkg_parse.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/pkg_parse.c')
-rw-r--r--libopkg/pkg_parse.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libopkg/pkg_parse.c b/libopkg/pkg_parse.c
index af5ead7..76cd648 100644
--- a/libopkg/pkg_parse.c
+++ b/libopkg/pkg_parse.c
@@ -141,7 +141,7 @@ int parseVersion(pkg_t *pkg, char *raw)
if (!pkg->version)
{
- pkg->version= malloc(strlen(raw)+1);
+ pkg->version= calloc(1, strlen(raw)+1);
if ( pkg->version == NULL ) {
fprintf(stderr, "%s: out of memory \n", __FUNCTION__);
return ENOMEM;
@@ -230,7 +230,7 @@ int pkg_parse_raw(pkg_t *pkg, char ***raw, pkg_src_t *src, pkg_dest_t *dest)
pkg->priority = parseGenericFieldType("Priority", *lines);
else if(isGenericFieldType("Provides", *lines)){
/* Here we add the internal_use to align the off by one problem between provides_str and provides */
- provide = (char * ) malloc(strlen(*lines)+ 35 ); /* Preparing the space for the new opkg_internal_use_only */
+ provide = (char * ) calloc(1, strlen(*lines)+ 35 ); /* Preparing the space for the new opkg_internal_use_only */
if ( alterProvidesLine(*lines,provide) ){
return EINVAL;
}
@@ -373,7 +373,7 @@ out:;
if ( pkg_false_provides==1)
{
pkg->provides_count = 1;
- pkg->provides_str = malloc (sizeof (char*));
+ pkg->provides_str = calloc (1, sizeof (char*));
pkg->provides_str[0] = strdup ("opkg_internal_use_only");
}