ap

An audio player suited to my tastes
Log | Files | Refs | README | LICENSE

commit 52bb19476ac4dae399ad5029215d8dcb61dc77a0
parent 287ac2c28639ae7663ccf652cbff9f54041bf0fc
Author: Jacob R. Edwards <n/a>
Date:   Sun,  9 Oct 2022 09:14:20 -0700

Free old status on every call to apc_read()

This will, in theory, prevent a failed call from being interpreted
as successful due to the previous status. This would happen since
the status is the only way to tell apart protocol errors from system
errors when apc_read() returns NULL (for example, see apc's
printresponse()).

Diffstat:
Mlib/ap/client.c | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/lib/ap/client.c b/lib/ap/client.c @@ -96,6 +96,11 @@ apc_read(struct apc *apc) size_t offset, len; char *buf, *end, *tmp; + if (apc->status) { + free(apc->status); + apc->status = NULL; + } + for (offset = 0; (end = memchr(apc->response->data + offset, '\n', apc->response->len - offset)) == NULL;) { offset += apc->response->len;