1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-08-13 17:03:46 -04:00

- 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 */
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) {