Skip to content

Commit

Permalink
Fixes an incorrect negation for freeing url_host in walrus.c
Browse files Browse the repository at this point in the history
The incorrect case causes memory to not be freed to give a small
leak. Would also cause a free of a NULL if the variable were NULL.
  • Loading branch information
Zach Hill committed Jan 24, 2013
1 parent 4064231 commit bde8223
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions storage/walrus.c
Expand Up @@ -502,7 +502,7 @@ static int walrus_request_timeout (const char * walrus_op, const char * verb, co
if (auth_str==NULL) {
close(fd);
pthread_mutex_unlock(&wreq_mutex);
if(!url_host) free(url_host);
if(url_host) free(url_host);
return ERROR;
}
assert (strlen(auth_str)+16<=BUFSIZE);
Expand Down Expand Up @@ -594,7 +594,7 @@ static int walrus_request_timeout (const char * walrus_op, const char * verb, co
}

free (auth_str);
if(!url_host) free(url_host);
if(url_host) free(url_host);
curl_slist_free_all (headers);
curl_easy_cleanup (curl);
pthread_mutex_unlock(&wreq_mutex);
Expand Down

0 comments on commit bde8223

Please sign in to comment.