mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-13 07:53:23 -05:00
[-] Misc housekeeping (minor memleaks, invalid free's)
This commit is contained in:
parent
3896f61d06
commit
26c22144fc
@ -226,6 +226,7 @@ commands_base_new(struct event_base *evbase, command_exit_cb exit_cb)
|
||||
int
|
||||
commands_base_free(struct commands_base *cmdbase)
|
||||
{
|
||||
event_free(cmdbase->command_event);
|
||||
close(cmdbase->command_pipe[0]);
|
||||
close(cmdbase->command_pipe[1]);
|
||||
free(cmdbase);
|
||||
|
@ -142,7 +142,7 @@ static struct event *exitev;
|
||||
static struct evhttp *evhttpd;
|
||||
static pthread_t tid_httpd;
|
||||
|
||||
static char *allow_origin;
|
||||
static const char *allow_origin;
|
||||
static int httpd_port;
|
||||
|
||||
#ifdef HAVE_LIBEVENT2_OLD
|
||||
@ -936,11 +936,11 @@ static void
|
||||
serve_file(struct evhttp_request *req, char *uri)
|
||||
{
|
||||
const char *host;
|
||||
const char *passwd;
|
||||
char *ext;
|
||||
char path[PATH_MAX];
|
||||
char *deref;
|
||||
char *ctype;
|
||||
char *passwd;
|
||||
struct evbuffer *evbuf;
|
||||
struct evkeyvalq *headers;
|
||||
struct stat sb;
|
||||
@ -1311,7 +1311,7 @@ httpd_fixup_uri(struct evhttp_request *req)
|
||||
static const char *http_reply_401 = "<html><head><title>401 Unauthorized</title></head><body>Authorization required</body></html>";
|
||||
|
||||
int
|
||||
httpd_basic_auth(struct evhttp_request *req, char *user, char *passwd, char *realm)
|
||||
httpd_basic_auth(struct evhttp_request *req, const char *user, const char *passwd, const char *realm)
|
||||
{
|
||||
struct evbuffer *evbuf;
|
||||
struct evkeyvalq *headers;
|
||||
|
@ -56,7 +56,7 @@ char *
|
||||
httpd_fixup_uri(struct evhttp_request *req);
|
||||
|
||||
int
|
||||
httpd_basic_auth(struct evhttp_request *req, char *user, char *passwd, char *realm);
|
||||
httpd_basic_auth(struct evhttp_request *req, const char *user, const char *passwd, const char *realm);
|
||||
|
||||
int
|
||||
httpd_init(void);
|
||||
|
@ -519,18 +519,21 @@ pipe_watch_update(void *arg, int *retval)
|
||||
pipelist_remove(&pipelist, pipe);
|
||||
}
|
||||
|
||||
for (pipe = pipelist; pipe; pipe = pipe->next)
|
||||
for (pipe = pipelist; pipe; pipe = next)
|
||||
{
|
||||
next = pipe->next;
|
||||
|
||||
count++;
|
||||
if (count > PIPE_MAX_WATCH)
|
||||
{
|
||||
DPRINTF(E_LOG, L_PLAYER, "Max open pipes reached, will not watch %s\n", pipe->path);
|
||||
break;
|
||||
DPRINTF(E_LOG, L_PLAYER, "Max open pipes reached (%d), will not watch '%s'\n", PIPE_MAX_WATCH, pipe->path);
|
||||
pipelist_remove(&pipelist, pipe);
|
||||
continue;
|
||||
}
|
||||
|
||||
DPRINTF(E_DBG, L_PLAYER, "Pipe watch added: '%s'\n", pipe->path);
|
||||
watch_add(pipe);
|
||||
pipelist_add(&pipe_watch_list, pipe);
|
||||
pipelist_add(&pipe_watch_list, pipe); // Changes pipe->next
|
||||
}
|
||||
|
||||
*retval = 0;
|
||||
|
@ -1017,7 +1017,7 @@ alsa_init(void)
|
||||
}
|
||||
|
||||
device->id = 0;
|
||||
device->name = nickname;
|
||||
device->name = strdup(nickname);
|
||||
device->type = OUTPUT_TYPE_ALSA;
|
||||
device->type_name = outputs_name(device->type);
|
||||
device->advertised = 1;
|
||||
|
@ -266,7 +266,7 @@ dummy_init(void)
|
||||
}
|
||||
|
||||
device->id = 0;
|
||||
device->name = nickname;
|
||||
device->name = strdup(nickname);
|
||||
device->type = OUTPUT_TYPE_DUMMY;
|
||||
device->type_name = outputs_name(device->type);
|
||||
device->advertised = 1;
|
||||
|
14
src/player.c
14
src/player.c
@ -2064,6 +2064,9 @@ playback_start_id(void *arg, int *retval)
|
||||
}
|
||||
|
||||
cmd_state = playback_start_item(queue_item, retval);
|
||||
|
||||
free_queue_item(queue_item, 0);
|
||||
|
||||
return cmd_state;
|
||||
}
|
||||
|
||||
@ -2084,6 +2087,9 @@ playback_start(void *arg, int *retval)
|
||||
}
|
||||
|
||||
cmd_state = playback_start_item(queue_item, retval);
|
||||
|
||||
free_queue_item(queue_item, 0);
|
||||
|
||||
return cmd_state;
|
||||
}
|
||||
|
||||
@ -3208,6 +3214,10 @@ player_deinit(void)
|
||||
timer_delete(pb_timer);
|
||||
#endif
|
||||
|
||||
input_deinit();
|
||||
|
||||
outputs_deinit();
|
||||
|
||||
player_exit = 1;
|
||||
commands_base_destroy(cmdbase);
|
||||
|
||||
@ -3219,10 +3229,6 @@ player_deinit(void)
|
||||
return;
|
||||
}
|
||||
|
||||
input_deinit();
|
||||
|
||||
outputs_deinit();
|
||||
|
||||
free(history);
|
||||
|
||||
event_base_free(evbase_player);
|
||||
|
Loading…
Reference in New Issue
Block a user