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>
This commit is contained in:
parent
fe8bd95092
commit
b25dda737b
1 changed files with 6 additions and 3 deletions
|
@ -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)
|
int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
|
||||||
{
|
{
|
||||||
char *newurl, *vdata = NULL;
|
char *newurl, *vdata = NULL;
|
||||||
|
int ret = 1;
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(db != NULL, return -1);
|
ASSERT(db != NULL, return -1);
|
||||||
|
@ -198,16 +199,18 @@ int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
|
||||||
if(!newurl) {
|
if(!newurl) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
db->servers = alpm_list_remove_str(db->servers, newurl, &vdata);
|
db->servers = alpm_list_remove_str(db->servers, newurl, &vdata);
|
||||||
free(newurl);
|
|
||||||
if(vdata) {
|
if(vdata) {
|
||||||
_alpm_log(db->handle, ALPM_LOG_DEBUG, "removed server URL from database '%s': %s\n",
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "removed server URL from database '%s': %s\n",
|
||||||
db->treename, newurl);
|
db->treename, newurl);
|
||||||
free(vdata);
|
free(vdata);
|
||||||
return 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
free(newurl);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get the name of a package database. */
|
/** Get the name of a package database. */
|
||||||
|
|
Loading…
Add table
Reference in a new issue