From bb53f1bc6664c3ae3cac8a74014d708624490e65 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Wed, 12 Jun 2019 22:39:18 +0200 Subject: [PATCH] ldpd: fix clang-SA warning in packet reading clang-SA thinks we can skip the SA but have something allocated in buf. Signed-off-by: David Lamparter --- ldpd/packet.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ldpd/packet.c b/ldpd/packet.c index 8ca90841de..dfab30eeb3 100644 --- a/ldpd/packet.c +++ b/ldpd/packet.c @@ -618,12 +618,17 @@ session_read(struct thread *thread) len -= msg_size; } free(buf); + buf = NULL; if (len != 0) { session_shutdown(nbr, S_BAD_PDU_LEN, 0, 0); return (0); } } + /* shouldn't happen, session_get_pdu should be > 0 if buf was + * allocated - but let's get rid of the SA warning. + */ + free(buf); return (0); }