diff options
author | Paul Barbu Gheorghe <barbu.paul.gheorghe@gmail.com> | 2012-07-30 19:57:43 +0000 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2012-11-27 15:16:15 +1000 |
commit | b25dda737b0b6f64f90b611ef909d065f4d3eee5 (patch) | |
tree | fd0b7a0a87d61c5bce8e7bbff063db14ee8fe90d /lib | |
parent | fe8bd95092f9c641f59b0ec5427140d324acc93d (diff) |
fixed erroneous memory access to newurl in alpm_db_remove_server
Signed-off-by: Barbu Paul - Gheorghe <barbu.paul.gheorghe@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libalpm/db.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index 1f252abb..fdb7ff9c 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -188,6 +188,7 @@ int SYMEXPORT alpm_db_add_server(alpm_db_t *db, const char *url) int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url) { char *newurl, *vdata = NULL; + int ret = 1; /* Sanity checks */ ASSERT(db != NULL, return -1); @@ -198,16 +199,18 @@ 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); + if(vdata) { _alpm_log(db->handle, ALPM_LOG_DEBUG, "removed server URL from database '%s': %s\n", db->treename, newurl); free(vdata); - return 0; + ret = 0; } - return 1; + free(newurl); + return ret; } /** Get the name of a package database. */ |