[OpenWrt-Devel] [PATCH rpcd v2 6/6] main: exec_self: make clang analyzer happy

Yousong Zhou yszhou4tech at gmail.com
Mon Oct 21 08:59:24 EDT 2019


Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
---
 main.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/main.c b/main.c
index 1db3241..12cb4c5 100644
--- a/main.c
+++ b/main.c
@@ -47,12 +47,16 @@ static void
 exec_self(int argc, char **argv)
 {
 	int i;
-	const char *cmd = rpc_exec_lookup(argv[0]);
-	char **args = calloc(argc + 1, sizeof(char *));
+	const char *cmd;
+	char **args;
 
-	if (!cmd || !args)
+	cmd = rpc_exec_lookup(argv[0]);
+	if (!cmd)
 		return;
 
+	args = calloc(argc + 1, sizeof(char *));
+	if (!args)
+		return;
 	for (i = 0; i < argc; i++)
 		args[i] = argv[i];
 

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list