Index: src/rhapsody/rhapsody.c =================================================================== --- src/rhapsody/rhapsody.c (revision 6679) +++ src/rhapsody/rhapsody.c (working copy) @@ -280,6 +280,7 @@ } } if (!*response) { + free(response_buf); continue; } @@ -311,6 +312,16 @@ while (tok != NULL) { ea_tmp[idx++] = strtol(tok, NULL, 10); + if (idx >= sizeof(request_buf)) { + /* Flush all but the last token, in case it is not complete */ + idx--; + LOG_DEBUG(log_audio_decode, "EA response: %d bytes", idx); + ea_block_write(r, ea_tmp, idx); + + ea_tmp[0] = ea_tmp[idx]; + idx = 1; + } + last_tok = tok; tok = strtok_r(NULL, "[],", &lasts); } @@ -329,7 +340,7 @@ ea_block_write(r, ea_tmp, idx); free(response_buf); - } while (err >= 0); + } while (1); /* parse last token */ if (tmp[0] != '\0') {