From 9a25518f73f6699685cb0256dcab8e77596bee05 Mon Sep 17 00:00:00 2001 From: Jianhui Zhao Date: Sun, 9 Sep 2018 01:49:51 +0800 Subject: [PATCH] Fix memory leak Signed-off-by: Jianhui Zhao --- src/command.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/command.c b/src/command.c index c7680f0..a0fc968 100644 --- a/src/command.c +++ b/src/command.c @@ -222,6 +222,7 @@ static void do_run_command(struct command *c) pipe2(epipe, O_CLOEXEC | O_NONBLOCK) < 0) { uwsc_log_err("pipe2 failed: %s\n", strerror(errno)); command_reply_error(c->ws, msg->id, RTTY_MESSAGE__COMMAND_ERR__SYSCALL); + command_free(c); return; } @@ -230,6 +231,7 @@ static void do_run_command(struct command *c) case -1: uwsc_log_err("fork: %s\n", strerror(errno)); command_reply_error(c->ws, msg->id, RTTY_MESSAGE__COMMAND_ERR__SYSCALL); + command_free(c); break; case 0: /* Close unused read end */