Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix potential Null pointer dereference in evhttp_client_test.cc #309

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions test/evhttp_client_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,17 @@ void http_request_done(struct evhttp_request* req, void* arg) {

TEST_UNIT(evhttpClientSample) {
struct event_base* base = event_base_new();
if (base == NULL) {
return;
}
#if defined(EVPP_HTTP_CLIENT_SUPPORTS_SSL)
struct evhttp_connection* conn = evhttp_connection_base_new(base, nullptr, "www.360.cn", 443);
#else
struct evhttp_connection* conn = evhttp_connection_base_new(base, nullptr, "www.360.cn", 80);
#endif
if (conn == NULL) {
return;
}
struct evhttp_request* req = evhttp_request_new(http_request_done, base); // will be free by evhttp_connection
evhttp_add_header(req->output_headers, "Host", "www.360.cn");
evhttp_make_request(conn, req, EVHTTP_REQ_GET, "/robots.txt");
Expand Down