Skip to content

Commit

Permalink
rest_client: Complete the fix in a3dd31a
Browse files Browse the repository at this point in the history
Proper pointer/data management.

Credits to Aron Podrigal (@ar45) for providing feedback and testing!
  • Loading branch information
liviuchircu committed Sep 12, 2024
1 parent 19dadf1 commit b15bc44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions modules/rest_client/rest_methods.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static int multi_pool_sz;
static map_t rcl_connections;
static gen_hash_t *rcl_parallel_connects;
int no_concurrent_connects;
int curl_conn_lifetime;
unsigned int curl_conn_lifetime;

static inline int rest_trace_enabled(void);
static int trace_rest_message( rest_trace_param_t* tparam );
Expand Down Expand Up @@ -581,7 +581,7 @@ int rcl_acquire_url(const char *url, char **url_host)
}

if (*connected_ts != 0 && (get_ticks() -
(unsigned int)*(unsigned long *)(*connected_ts) < curl_conn_lifetime)) {
(unsigned int)*(unsigned long *)connected_ts < curl_conn_lifetime)) {
new_connection = 0;
} else {
new_connection = 1;
Expand Down Expand Up @@ -631,8 +631,8 @@ void rcl_release_url(char *url_host, int update_conn_ts)
void **connected_ts;

connected_ts = map_get(rcl_connections, host_str);
if (connected_ts && *connected_ts)
*(unsigned long *)(*connected_ts) = (unsigned long)get_ticks();
if (connected_ts)
*connected_ts = (void *)(unsigned long)get_ticks();
}

pkg_free(url_host);
Expand Down
2 changes: 1 addition & 1 deletion modules/rest_client/rest_methods.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ extern int ssl_verifyhost;

extern int curl_http_version;
extern int no_concurrent_connects;
extern int curl_conn_lifetime;
extern unsigned int curl_conn_lifetime;

/* handle for use with synchronous reqs */
extern CURL *sync_handle;
Expand Down

0 comments on commit b15bc44

Please sign in to comment.