[pacman-dev] [PATCH 2/4] be_local.c: Fix memory leak in _alpm_local_db_write()
Dan McGee
dpmcgee at gmail.com
Sun Aug 28 20:47:55 EDT 2011
On Fri, Aug 26, 2011 at 6:10 AM, Lukas Fleischer
<archlinux at cryptocrack.de> wrote:
> Jump to the cleanup label, free "pkgpath" and restore umask if a
> non-local database is passed.
>
> Signed-off-by: Lukas Fleischer <archlinux at cryptocrack.de>
This seemed like the better solution, but thanks for pointing out the problem:
diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c
index f53bd64..1a46dfd 100644
--- a/lib/libalpm/be_local.c
+++ b/lib/libalpm/be_local.c
@@ -750,7 +750,7 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t
*info, alpm_dbinfrq_t inforeq
int retval = 0;
char *pkgpath = NULL;
- if(db == NULL || info == NULL) {
+ if(db == NULL || info == NULL || !(db->status & DB_STATUS_LOCAL)) {
return -1;
}
@@ -759,10 +759,6 @@ int _alpm_local_db_write(alpm_db_t *db,
alpm_pkg_t *info, alpm_dbinfrq_t inforeq
/* make sure we have a sane umask */
oldmask = umask(0022);
- if(strcmp(db->treename, "local") != 0) {
- return -1;
- }
-
/* DESC */
if(inforeq & INFRQ_DESC) {
_alpm_log(db->handle, ALPM_LOG_DEBUG, "writing %s-%s
DESC information back to db\n",
More information about the pacman-dev
mailing list