summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-09-27 17:47:40 -0500
committerDan McGee <dan@archlinux.org>2011-09-27 17:52:38 -0500
commit69962184bb3cc313f744de6553ef31b4eb256a01 (patch)
tree99dd39bc83bd822c851cf61fd1718663553f47de /lib/libalpm
parentd8fab9b4415b2382c9b5d92f6d0d40074ab65f30 (diff)
_alpm_splitdep: use malloc instead of calloc
There was only one simple to handle case where we left a field uninitialized; set it to NULL and use malloc() instead. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/deps.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index c99701e9..60401583 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -409,14 +409,14 @@ int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep)
alpm_depend_t *_alpm_splitdep(const char *depstring)
{
alpm_depend_t *depend;
- const char *ptr, *version = NULL;
+ const char *ptr, *version;
size_t deplen;
if(depstring == NULL) {
return NULL;
}
- CALLOC(depend, 1, sizeof(alpm_depend_t), return NULL);
+ MALLOC(depend, sizeof(alpm_depend_t), return NULL);
deplen = strlen(depstring);
/* Find a version comparator if one exists. If it does, set the type and
@@ -442,8 +442,10 @@ alpm_depend_t *_alpm_splitdep(const char *depstring)
depend->mod = ALPM_DEP_MOD_EQ;
version = ptr + 1;
} else {
- /* no version specified, leave version and ptr NULL */
+ /* no version specified, leave ptr NULL and set version to NULL */
depend->mod = ALPM_DEP_MOD_ANY;
+ depend->version = NULL;
+ version = NULL;
}
/* copy the right parts to the right places */