From 98348b8fe9678a9efa24b6a12871972382463308 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Sat, 11 Feb 2017 00:28:29 +0100 Subject: [PATCH] [pipe] Removing CHECK_NULL with malloc, scan-build not happy about it --- src/inputs/pipe.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/inputs/pipe.c b/src/inputs/pipe.c index 2aea418b..bc2be510 100644 --- a/src/inputs/pipe.c +++ b/src/inputs/pipe.c @@ -711,21 +711,22 @@ static void pipe_listener_cb(enum listener_event_type type) { union pipe_arg *cmdarg; - struct pipe *pipelist; - pipelist = pipelist_create(); - if (!pipelist) + cmdarg = malloc(sizeof(union pipe_arg)); + if (!cmdarg) + return; + + cmdarg->pipelist = pipelist_create(); + if (!cmdarg->pipelist) { pipe_thread_stop(); + free(cmdarg); return; } if (!tid_pipe) pipe_thread_start(); - CHECK_NULL(L_PLAYER, cmdarg = malloc(sizeof(union pipe_arg))); - - cmdarg->pipelist = pipelist; commands_exec_async(cmdbase, pipe_watch_update, cmdarg); } @@ -815,9 +816,8 @@ stop(struct player_source *ps) // Reset the pipe and start watching it again for new data. Must be async or // we will deadlock from the stop in pipe_read_cb(). - if (pipe_autostart) + if (pipe_autostart && (cmdarg = malloc(sizeof(union pipe_arg)))) { - CHECK_NULL(L_PLAYER, cmdarg = malloc(sizeof(union pipe_arg))); cmdarg->id = pipe->id; commands_exec_async(cmdbase, pipe_watch_reset, cmdarg); }