From: Daniel Miller Date: Fri, 10 Dec 2021 17:27:30 +0000 (-0600) Subject: Avoid calling free() on known-null pointer X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/51c5231b21b9390dc8926d2a592d61d2bbcee316 Avoid calling free() on known-null pointer Standards all say free(NULL) is a safe no-op, but since we *know* fp is NULL here because of the condition above, there's no need to risk it. --- diff --git a/optimize.c b/optimize.c index 604e35e8..6fefeada 100644 --- a/optimize.c +++ b/optimize.c @@ -2899,7 +2899,6 @@ icode_to_fcode(struct icode *ic, struct block *root, u_int *lenp, if (fp == NULL) { (void)snprintf(errbuf, PCAP_ERRBUF_SIZE, "malloc"); - free(fp); return NULL; } memset((char *)fp, 0, sizeof(*fp) * n);