From: Stephan Bosch Date: Sun, 27 Apr 2014 16:05:38 +0000 (+0300) Subject: lib-http: http-client: Prevented http_client_request_continue_payload() from segfault... X-Git-Tag: 2.2.13.rc1~85 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b36e026fb1e31bb76524cb345eb40c73e528507b;p=thirdparty%2Fdovecot%2Fcore.git lib-http: http-client: Prevented http_client_request_continue_payload() from segfaulting when the callback sets the request pointer to NULL. --- diff --git a/src/lib-http/http-client-request.c b/src/lib-http/http-client-request.c index d0a5ebcafb..c77b168d49 100644 --- a/src/lib-http/http-client-request.c +++ b/src/lib-http/http-client-request.c @@ -524,7 +524,13 @@ http_client_request_continue_payload(struct http_client_request **_req, } req->payload_wait = FALSE; - http_client_request_unref(_req); + + /* callback may have messed with our pointer, + so unref using local variable */ + http_client_request_unref(&req); + if (req == NULL) + *_req = NULL; + if (conn != NULL) http_client_connection_unref(&conn);