Fix memory leak due to missing free for evconnlistener
This commit is contained in:
parent
6c26d87997
commit
1ed240d92c
|
@ -71,6 +71,8 @@ static struct event *g_cmdev;
|
|||
|
||||
static struct evhttp *evhttpd;
|
||||
|
||||
struct evconnlistener *listener;
|
||||
|
||||
struct mpd_command;
|
||||
|
||||
typedef int (*cmd_func)(struct mpd_command *cmd);
|
||||
|
@ -4394,7 +4396,6 @@ artwork_cb(struct evhttp_request *req, void *arg)
|
|||
/* Thread: main */
|
||||
int mpd_init(void)
|
||||
{
|
||||
struct evconnlistener *listener;
|
||||
struct sockaddr *saddr;
|
||||
size_t saddr_length;
|
||||
struct sockaddr_in sin;
|
||||
|
@ -4546,6 +4547,7 @@ int mpd_init(void)
|
|||
if (http_port > 0)
|
||||
evhttp_free(evhttpd);
|
||||
evhttp_fail:
|
||||
evconnlistener_free(listener);
|
||||
connew_fail:
|
||||
evnew_fail:
|
||||
event_base_free(evbase_mpd);
|
||||
|
@ -4600,6 +4602,8 @@ void mpd_deinit(void)
|
|||
if (http_port > 0)
|
||||
evhttp_free(evhttpd);
|
||||
|
||||
evconnlistener_free(listener);
|
||||
|
||||
// Free event base (should free events too)
|
||||
event_base_free(evbase_mpd);
|
||||
|
||||
|
|
Loading…
Reference in New Issue