Summary
base is created successfully and no event_base_free(base) exists on the normal path or the later error paths. The comment claiming the tail is unreachable is not a valid ownership transfer.
Affected code
- Repository commit:
477033f938fd47dfecde43c82257cd286d9fa38e
- File:
benchmark/http/libevent/libevent_http_bench.c
- Original scanner location: line 153
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 181-196
181: evhttp_bind_socket(http, "0.0.0.0", port);
182:
183: #ifdef _WIN32
184: if (use_iocp) {
185: struct timeval tv={99999999,0};
186: event_base_loopexit(base, &tv);
187: }
188: #endif
189: event_base_dispatch(base);
190:
191: #ifdef _WIN32
192: WSACleanup();
193: #endif
194:
195: /* NOTREACHED */
196: return (0);
Impact
When the event loop exits, the benchmark retains the event base and its internal allocations until process termination.
Summary
baseis created successfully and noevent_base_free(base)exists on the normal path or the later error paths. The comment claiming the tail is unreachable is not a valid ownership transfer.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 181-196
Impact
When the event loop exits, the benchmark retains the event base and its internal allocations until process termination.