From: Lioncash Date: Sun, 26 Oct 2014 23:02:10 +0000 (-0400) Subject: soc: Add missing va_end() calls in fcntl. X-Git-Tag: v0.2.0~82^2 X-Git-Url: https://chaos.moe/g/?a=commitdiff_plain;h=1b0a0368d7f3342721ecc9c12f5881f3473bd9ec;p=corbenik%2Fctrulib.git soc: Add missing va_end() calls in fcntl. --- diff --git a/libctru/source/services/soc.c b/libctru/source/services/soc.c index 3791b9f..5320e00 100644 --- a/libctru/source/services/soc.c +++ b/libctru/source/services/soc.c @@ -648,7 +648,6 @@ int fcntl(int sockfd, int cmd, ...) u32 *cmdbuf = getThreadCommandBuffer(); va_list args; - va_start(args, cmd); if(cmd!=F_GETFL && cmd!=F_SETFL) { @@ -656,6 +655,7 @@ int fcntl(int sockfd, int cmd, ...) return -1; } + va_start(args, cmd); if(cmd==F_SETFL) { arg = va_arg(args, int); @@ -663,11 +663,13 @@ int fcntl(int sockfd, int cmd, ...) if(arg && arg!=O_NONBLOCK) { SOCU_errno = -EINVAL; + va_end(args); return -1; } if(arg==O_NONBLOCK)arg = 0x4; } + va_end(args); cmdbuf[0] = 0x001300C2; cmdbuf[1] = (u32)sockfd;