summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2017-04-11 13:17:54 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2017-04-11 13:17:54 -0400
commit8e97c84c0f491247ea200d93367aa1d81e6105c1 (patch)
treeec8ce01668f958f68338ec7af32a1644c4ec5fa2
parentbd0b2592d1e7884bc8825d8bf8220de376f244d1 (diff)
downloadlighttpd1.4-8e97c84c0f491247ea200d93367aa1d81e6105c1.tar.gz
lighttpd1.4-8e97c84c0f491247ea200d93367aa1d81e6105c1.zip
[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
-rw-r--r--src/mod_extforward.c1
-rw-r--r--src/stat_cache.c11
2 files changed, 7 insertions, 5 deletions
diff --git a/src/mod_extforward.c b/src/mod_extforward.c
index cecb3c5f..83284bd2 100644
--- a/src/mod_extforward.c
+++ b/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;
}
diff --git a/src/stat_cache.c b/src/stat_cache.c
index 48a38c5a..c08d2dd7 100644
--- a/src/stat_cache.c
+++ b/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