ap

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

commit 0292e15089d39b9afc7f81a99b51de44c5c34314
parent 1975b6f9550fabddf24814cf747b2f4402552f25
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Thu, 15 Jul 2021 16:00:46 -0700

Fix pstart NULL dereference

If pplay was given a NULL path while the player was not suspended
or running the path would later be used in strdup. In addition to
fixing this, error handling from pstart was reused.

Diffstat:
Maps/player.c | 8++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/aps/player.c b/aps/player.c @@ -102,14 +102,10 @@ pplay(struct player *p, char *path) return 1; } - if (path == NULL || - (p->path != NULL && strcmp(p->path, path) == 0)) { + if (path == NULL || (p->path != NULL && strcmp(p->path, path) == 0)) { if (p->state == SUSPENDED) return pcontinue(p); - if (p->state == RUNNING) { - errno = EALREADY; - return 1; - } + return pstart(p); } if (p->state & (SUSPENDED | RUNNING) && pstop(p))