diff options
author | Aurelien Foret <aurelien@archlinux.org> | 2005-03-26 21:20:03 +0000 |
---|---|---|
committer | Aurelien Foret <aurelien@archlinux.org> | 2005-03-26 21:20:03 +0000 |
commit | e39d05b31b67c9cbc3379d44751fb6f3403c3911 (patch) | |
tree | 5792a8e786988f09b857160c985aa9ea17ceb2e7 /lib/libalpm | |
parent | 03f2ec2d0bf9ddd8e175afed3304a588694b9d15 (diff) | |
download | pacman-e39d05b31b67c9cbc3379d44751fb6f3403c3911.tar.xz |
- fixed a small memory leak
- took into account sliptdep returned value
Diffstat (limited to 'lib/libalpm')
-rw-r--r-- | lib/libalpm/remove.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index 10e89b18..8f778576 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -146,7 +146,6 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans) /* iterate through the list backwards, unlinking files */ for(lp = pm_list_last(info->files); lp; lp = lp->prev) { - char *newpath = NULL; int nb = 0; char *file = lp->data; if(_alpm_needbackup(lp->data, info->backup)) { @@ -175,8 +174,8 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans) /* we're upgrading so just leave the file as is. pacman_add() will handle it */ } else { if(!(trans->flags & PM_TRANS_FLAG_NOSAVE)) { - newpath = (char*)realloc(newpath, strlen(line)+strlen(".pacsave")+1); - sprintf(newpath, "%s.pacsave", line); + char newpath[PATH_MAX]; + snprintf(newpath, PATH_MAX, "%s.pacsave", line); rename(line, newpath); _alpm_log(PM_LOG_WARNING, "%s saved as %s", file, newpath); alpm_logaction("%s saved as %s", line, newpath); @@ -212,6 +211,7 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans) _alpm_log(PM_LOG_ERROR, "failed to remove database entry %s/%s-%s", db->treename, info->name, info->version); } + /* update dependency packages' REQUIREDBY fields */ _alpm_log(PM_LOG_FLOW2, "updating dependency packages 'requiredby' fields"); for(lp = info->depends; lp; lp = lp->next) { @@ -219,7 +219,9 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans) pmpkg_t *depinfo = NULL; pmdepend_t depend; - splitdep((char*)lp->data, &depend); + if(splitdep((char*)lp->data, &depend)) { + continue; + } depinfo = db_scan(db, depend.name, INFRQ_DESC|INFRQ_DEPENDS); if(depinfo == NULL) { |