[pacman-dev] [PATCH] _alpm_db_add_pkgincache: free potential memory leak
Signed-off-by: Allan McRae <allan@archlinux.org> --- lib/libalpm/db.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index 0ca12d7..a122ccc 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -572,6 +572,8 @@ int _alpm_db_add_pkgincache(alpm_db_t *db, alpm_pkg_t *pkg) } if(_alpm_pkg_dup(pkg, &newpkg)) { + /* we return memory on "non-fatal" error in _alpm_pkg_dup */ + _alpm_pkg_free(copy); return -1; } -- 2.2.1
On 24/12/14 12:27, Allan McRae wrote:
Signed-off-by: Allan McRae <allan@archlinux.org> --- lib/libalpm/db.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index 0ca12d7..a122ccc 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -572,6 +572,8 @@ int _alpm_db_add_pkgincache(alpm_db_t *db, alpm_pkg_t *pkg) }
if(_alpm_pkg_dup(pkg, &newpkg)) { + /* we return memory on "non-fatal" error in _alpm_pkg_dup */ + _alpm_pkg_free(copy);
s/copy/newpkg/
return -1; }
participants (1)
-
Allan McRae