From: Daniel Stenberg Date: Thu, 27 Jun 2024 06:45:06 +0000 (+0200) Subject: lib: add a few DEBUGASSERT(data) to aid code analyzers X-Git-Tag: curl-8_9_0~175 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9a49af5fd8b898bcc9a6ef5484b8eb5084f45a83;p=thirdparty%2Fcurl.git lib: add a few DEBUGASSERT(data) to aid code analyzers ... where 'data' is assumed to always work. Closes #14033 --- diff --git a/lib/conncache.c b/lib/conncache.c index cc9765742b..95042abe42 100644 --- a/lib/conncache.c +++ b/lib/conncache.c @@ -662,6 +662,7 @@ static void connc_discard_conn(struct conncache *connc, struct Curl_easy *data = last_data? last_data : connc->closure_handle; bool done = FALSE; + DEBUGASSERT(data); DEBUGASSERT(connc); DEBUGASSERT(!conn->bundle); @@ -906,6 +907,7 @@ static void connc_perform(struct conncache *connc) if(!e) return; + DEBUGASSERT(data); DEBUGASSERT(!connc->shutdowns.iter_locked); DEBUGF(infof(data, "[CCACHE] perform, %zu connections being shutdown", Curl_llist_count(&connc->shutdowns.conn_list))); diff --git a/lib/multi.c b/lib/multi.c index d510e43bc3..2139565189 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -1010,8 +1010,9 @@ void Curl_detach_connection(struct Curl_easy *data) * This is the only function that should assign data->conn */ void Curl_attach_connection(struct Curl_easy *data, - struct connectdata *conn) + struct connectdata *conn) { + DEBUGASSERT(data); DEBUGASSERT(!data->conn); DEBUGASSERT(conn); data->conn = conn;