Summary
event_config_new() allocates cfg. After event_base_new_with_config() the config can be freed, but the benchmark never calls event_config_free() on success or failure.
Affected code
- Repository commit:
477033f938fd47dfecde43c82257cd286d9fa38e
- File:
benchmark/http/libevent/libevent_http_bench.c
- Original scanner location: line 87
Evidence
Source: benchmark/http/libevent/libevent_http_bench.c lines 84-90
84: int
85: main(int argc, char **argv)
86: {
87: struct event_config *cfg = event_config_new();
88: struct event_base *base;
89: struct evhttp *http;
90: int i;
Source: benchmark/http/libevent/libevent_http_bench.c lines 151-160
151: }
152:
153: base = event_base_new_with_config(cfg);
154: if (!base) {
155: fprintf(stderr, "creating event_base failed. Exiting.\n");
156: return 1;
157: }
158:
159: http = evhttp_new(base);
160:
Source: benchmark/http/libevent/libevent_http_bench.c lines 189-196
189: event_base_dispatch(base);
190:
191: #ifdef _WIN32
192: WSACleanup();
193: #endif
194:
195: /* NOTREACHED */
196: return (0);
Impact
The configuration object remains allocated for the full benchmark process, including early-return paths.
Summary
event_config_new()allocatescfg. Afterevent_base_new_with_config()the config can be freed, but the benchmark never callsevent_config_free()on success or failure.Affected code
477033f938fd47dfecde43c82257cd286d9fa38ebenchmark/http/libevent/libevent_http_bench.cEvidence
Source: benchmark/http/libevent/libevent_http_bench.c lines 84-90
Source: benchmark/http/libevent/libevent_http_bench.c lines 151-160
Source: benchmark/http/libevent/libevent_http_bench.c lines 189-196
Impact
The configuration object remains allocated for the full benchmark process, including early-return paths.