This lot are all small issues derived from allocating new memory and
assigning to a pointer already pointing at previous allocation, or
passing xstrdup() output to a caller which does not directly hold the
passed memory.
Both cases will disappear once we clean up teh string handlign in Squid
but for now these still need fixing to avoid leaking memory.
Detected by Coverity Scan. Issues 740430, 740432, 740439.
while (strListGetItem(&buf, ',', &item, &ilen, &pos)) {
if (ilen == 1 && *item == '*')
foundStar = true;
- else
- add(xstrndup(item, ilen+1));
+ else {
+ const char *tmp = xstrndup(item, ilen+1);
+ add(tmp);
+ xfree(tmp);
+ }
}
}
cfg_filename = orig_cfg_filename;
config_lineno = orig_config_lineno;
+ xfree(tmp_line);
return err_count;
}
/** \par l
* Stores the syslog facility name in global opt_syslog_facility
* then performs actions for -s option. */
+ xfree(opt_syslog_facility); // ignore any previous options sent
opt_syslog_facility = xstrdup(optarg);
case 's':