Browse Source

[core] fix stat_cache initialization error

fix stat_cache initialization error (coverity identified memory leak)
  (bug introduced when moving stat_cache_init code from server.c to
   stat_cache.c)

quell insignificant coverity warning in mod_extforward
personal/stbuehler/mod-csrf
Glenn Strauss 5 years ago
parent
commit
8e97c84c0f
  1. 1
      src/mod_extforward.c
  2. 11
      src/stat_cache.c

1
src/mod_extforward.c

@ -1603,6 +1603,7 @@ static int mod_extforward_network_read (server *srv, connection *con,
case -2: log_error_write(srv, __FILE__, __LINE__, "s",
"hap-PROXY proto received "
"invalid/unsupported request");
/* fall through */
default: rc = -1; break;
}

11
src/stat_cache.c

@ -129,18 +129,19 @@ stat_cache *stat_cache_init(server *srv) {
#ifdef HAVE_FAM_H
/* setup FAM */
if (srv->srvconf.stat_cache_engine == STAT_CACHE_ENGINE_FAM) {
if (0 != FAMOpen2(&srv->stat_cache->fam, "lighttpd")) {
if (0 != FAMOpen2(&sc->fam, "lighttpd")) {
log_error_write(srv, __FILE__, __LINE__, "s",
"could not open a fam connection, dieing.");
free(sc);
return NULL;
}
#ifdef HAVE_FAMNOEXISTS
FAMNoExists(&srv->stat_cache->fam);
FAMNoExists(&sc->fam);
#endif
fd_close_on_exec(FAMCONNECTION_GETFD(&srv->stat_cache->fam));
fdevent_register(srv->ev, FAMCONNECTION_GETFD(&srv->stat_cache->fam), stat_cache_handle_fdevent, NULL);
fdevent_event_set(srv->ev, &(srv->stat_cache->fam_fcce_ndx), FAMCONNECTION_GETFD(&srv->stat_cache->fam), FDEVENT_IN);
fd_close_on_exec(FAMCONNECTION_GETFD(&sc->fam));
fdevent_register(srv->ev, FAMCONNECTION_GETFD(&sc->fam), stat_cache_handle_fdevent, NULL);
fdevent_event_set(srv->ev, &(sc->fam_fcce_ndx), FAMCONNECTION_GETFD(&sc->fam), FDEVENT_IN);
}
#endif

Loading…
Cancel
Save