Skip to content

Commit

Permalink
httpd: make sure cb exists to prevent a crash
Browse files Browse the repository at this point in the history
Fixes Coverity CID 40663 and 40922
  • Loading branch information
razvancrainea committed Oct 24, 2016
1 parent bfdeb34 commit ea765d7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/httpd/httpd_proc.c
Expand Up @@ -397,7 +397,7 @@ int answer_to_connection (void *cls, struct MHD_Connection *connection,
struct MHD_Response *response;
int ret;
void *async_data = NULL;
struct httpd_cb *cb;
struct httpd_cb *cb NULL;
const char *normalised_url;
struct post_request *pr;
str_str_t *kv;
Expand Down Expand Up @@ -641,7 +641,7 @@ int answer_to_connection (void *cls, struct MHD_Connection *connection,
#endif
LM_DBG("MHD_create_response_from_data [%p:%d]\n",
page.s, page.len);
} else {
} else if (cb) {
LM_DBG("MHD_create_response_from_callback\n");
response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN,
buffer.len,
Expand Down

0 comments on commit ea765d7

Please sign in to comment.