1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-09-22 04:15:54 -04:00

Fix: fix memory leak of active and pending ypdata_t

This (hopefully) fixes a memory leak that caused active and
pending ypdata_t objects to be not freed up on server shutdown
or config reload.

To testers: please enable yp submission and restart and SIGHUP
your instance several times with loglevel set to warning or higher.
Each time after shutdown or SIGHUP check your log for one of the
following two warnings:
 * 'active ypdata not freed up'
 * 'pending ypdata not freed up'

Those warnings must not be in the log. If you spot one please report.
This commit is contained in:
Philipp Schafft 2015-01-18 17:51:58 +00:00
parent cc613d405f
commit 319b6d577f

View File

@ -99,6 +99,8 @@ static void add_yp_info(ypdata_t *yp, void *info, int type);
static int do_yp_remove(ypdata_t *yp, char *s, unsigned len);
static int do_yp_add(ypdata_t *yp, char *s, unsigned len);
static int do_yp_touch(ypdata_t *yp, char *s, unsigned len);
static void add_pending_yp (struct yp_server *server);
static void delete_marked_yp(struct yp_server *server);
static void yp_destroy_ypdata(ypdata_t *ypdata);
@ -178,9 +180,25 @@ static struct yp_server *find_yp_server (const char *url)
static void destroy_yp_server (struct yp_server *server)
{
ypdata_t *yp;
if (server == NULL)
return;
ICECAST_LOG_DEBUG("Removing YP server entry for %s", server->url);
/* delete yps:
* first move all pendings into main queue.
* then mark all main queue entries for deleting.
* then remove all marked entries.
*/
add_pending_yp(server);
yp = server->mounts;
while (yp) {
yp->remove = 1;
yp = yp->next;
}
delete_marked_yp(server);
if (server->curl)
curl_easy_cleanup (server->curl);
if (server->mounts) ICECAST_LOG_WARN("active ypdata not freed up");