Skip to content

libevent HTTP benchmark never frees event_config #317

Description

@OneBucket126

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions