From f6ab04addb97b22c488db2910d3582c31692db24 Mon Sep 17 00:00:00 2001 From: zhanghongyu Date: Fri, 21 Oct 2022 11:04:52 +0800 Subject: [PATCH] dhcpc: codechecker issuse fix presult->serverid.s_addr maybe is garbage or undefined Signed-off-by: zhanghongyu --- netutils/dhcpc/dhcpc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/netutils/dhcpc/dhcpc.c b/netutils/dhcpc/dhcpc.c index eb5be2f43..92f484364 100644 --- a/netutils/dhcpc/dhcpc.c +++ b/netutils/dhcpc/dhcpc.c @@ -696,6 +696,8 @@ int dhcpc_request(FAR void *handle, FAR struct dhcpc_state *presult) int state; clock_t start; + memset(presult, 0, sizeof(*presult)); + /* RFC2131: For example, a client may choose a different, * random initial 'xid' each time the client is rebooted, and * subsequently use sequential 'xid's until the next reboot.