Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   ArchLinux Pacman Development (http://www.linux-archive.org/archlinux-pacman-development/)
-   -   fixed erroneous memory access to newurl in alpm_db_remove_server (http://www.linux-archive.org/archlinux-pacman-development/689015-fixed-erroneous-memory-access-newurl-alpm_db_remove_server.html)

Barbu Paul - Gheorghe 07-30-2012 07:57 PM

fixed erroneous memory access to newurl in alpm_db_remove_server
 
Signed-off-by: Barbu Paul - Gheorghe <barbu.paul.gheorghe@gmail.com>
---
lib/libalpm/db.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index bf9c3f0..26b6250 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -198,16 +198,20 @@ int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
if(!newurl) {
return -1;
}
+
db->servers = alpm_list_remove_str(db->servers, newurl, &vdata);
- free(newurl);
+
+ int ret = 1;
+
if(vdata) {
_alpm_log(db->handle, ALPM_LOG_DEBUG, "removed server URL from database '%s': %s
",
db->treename, newurl);
free(vdata);
- return 0;
+ ret = 0;
}

- return 1;
+ free(newurl);
+ return ret;
}

/** Get the name of a package database. */
--
Barbu Paul - Gheorghe
Common sense is not so common - Voltaire
Visit My GitHub profile to see my open-source projects - https://github.com/paullik


All times are GMT. The time now is 10:08 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.