diff --git a/CHANGELOG.md b/CHANGELOG.md index e6d3593f2..a5b9528a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ This is a small bug fix release. ### Changelog - Upd: Translations +- Fix: Add correct number of songs to sticker based smart playlist #1369 - Fix: Remove duplicate depends in Debian Control file *** diff --git a/src/mpd_worker/smartpls.c b/src/mpd_worker/smartpls.c index 82fa957ae..cbd4bbafd 100644 --- a/src/mpd_worker/smartpls.c +++ b/src/mpd_worker/smartpls.c @@ -431,13 +431,14 @@ static bool mpd_worker_smartpls_update_sticker(struct t_mpd_worker_state *mpd_wo unsigned i = 0; struct t_list_node *current; bool rc = true; - while (i < add_list->length) { + while (add_list->length > 0) { if (mpd_command_list_begin(mpd_worker_state->partition_state->conn, false)) { unsigned j = 0; while ((current = list_shift_first(add_list)) != NULL) { i++; j++; if (mpd_send_playlist_add(mpd_worker_state->partition_state->conn, playlist, current->key) == false) { + list_node_free(current); mympd_set_mpd_failure(mpd_worker_state->partition_state, "Error adding command to command list mpd_send_playlist_add"); break; }