- fixed a small memory leak

- took into account sliptdep returned value
This commit is contained in:
Aurelien Foret 2005-03-26 21:20:03 +00:00
parent 03f2ec2d0b
commit e39d05b31b

View file

@ -146,7 +146,6 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans)
/* iterate through the list backwards, unlinking files */ /* iterate through the list backwards, unlinking files */
for(lp = pm_list_last(info->files); lp; lp = lp->prev) { for(lp = pm_list_last(info->files); lp; lp = lp->prev) {
char *newpath = NULL;
int nb = 0; int nb = 0;
char *file = lp->data; char *file = lp->data;
if(_alpm_needbackup(lp->data, info->backup)) { 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 */ /* we're upgrading so just leave the file as is. pacman_add() will handle it */
} else { } else {
if(!(trans->flags & PM_TRANS_FLAG_NOSAVE)) { if(!(trans->flags & PM_TRANS_FLAG_NOSAVE)) {
newpath = (char*)realloc(newpath, strlen(line)+strlen(".pacsave")+1); char newpath[PATH_MAX];
sprintf(newpath, "%s.pacsave", line); snprintf(newpath, PATH_MAX, "%s.pacsave", line);
rename(line, newpath); rename(line, newpath);
_alpm_log(PM_LOG_WARNING, "%s saved as %s", file, newpath); _alpm_log(PM_LOG_WARNING, "%s saved as %s", file, newpath);
alpm_logaction("%s saved as %s", line, 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); _alpm_log(PM_LOG_ERROR, "failed to remove database entry %s/%s-%s", db->treename, info->name, info->version);
} }
/* update dependency packages' REQUIREDBY fields */ /* update dependency packages' REQUIREDBY fields */
_alpm_log(PM_LOG_FLOW2, "updating dependency packages 'requiredby' fields"); _alpm_log(PM_LOG_FLOW2, "updating dependency packages 'requiredby' fields");
for(lp = info->depends; lp; lp = lp->next) { 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; pmpkg_t *depinfo = NULL;
pmdepend_t depend; 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); depinfo = db_scan(db, depend.name, INFRQ_DESC|INFRQ_DEPENDS);
if(depinfo == NULL) { if(depinfo == NULL) {