From 05d67a9f95ca3ed2c2ffaf8bb8e157a8e6194dc0 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 14 Feb 2019 13:16:02 -0800 Subject: [PATCH 470/470] Plug memory leak. If the URL had "file" as the scheme, *and* if we couldn't allocate memory for the path, we'd leak the memory we allocated for the scheme. Should address Coverity CID 1442632 (although Coverity misdiagnosed the underlying problem). --- pcap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pcap.c b/pcap.c index c134cd6..7336260 100644 --- a/pcap.c +++ b/pcap.c @@ -1663,13 +1663,14 @@ pcap_parse_source(const char *source, char **schemep, char **userinfop, * the pathname. */ if (pcap_strcasecmp(scheme, "file") == 0) { - *schemep = scheme; *pathp = strdup(colonp + 3); if (*pathp == NULL) { pcap_fmt_errmsg_for_errno(ebuf, PCAP_ERRBUF_SIZE, errno, "malloc"); + free(scheme); return (-1); } + *schemep = scheme; return (0); } -- 1.8.3.1