diff --git a/src/commands.c b/src/commands.c index a799aa83..e8a536a0 100644 --- a/src/commands.c +++ b/src/commands.c @@ -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); diff --git a/src/httpd.c b/src/httpd.c index e3966122..af45ecc4 100644 --- a/src/httpd.c +++ b/src/httpd.c @@ -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 = "401 UnauthorizedAuthorization required"; 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; diff --git a/src/httpd.h b/src/httpd.h index 7cd0f8fd..bec6efc2 100644 --- a/src/httpd.h +++ b/src/httpd.h @@ -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); diff --git a/src/inputs/pipe.c b/src/inputs/pipe.c index bc2be510..893c18e1 100644 --- a/src/inputs/pipe.c +++ b/src/inputs/pipe.c @@ -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; diff --git a/src/outputs/alsa.c b/src/outputs/alsa.c index 20a902c4..b7ba9253 100644 --- a/src/outputs/alsa.c +++ b/src/outputs/alsa.c @@ -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; diff --git a/src/outputs/dummy.c b/src/outputs/dummy.c index 9599d0ae..e5dfad2e 100644 --- a/src/outputs/dummy.c +++ b/src/outputs/dummy.c @@ -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; diff --git a/src/player.c b/src/player.c index 119f4079..38afb60c 100644 --- a/src/player.c +++ b/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);