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).
* 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);
}