fix usage

fix null free crash when called w/out arguments


git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14112 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Rupa Schomaker 2009-07-02 15:23:54 +00:00
parent 65d596b27e
commit 56d63b1097

View File

@ -43,7 +43,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_curl_load);
*/ */
SWITCH_MODULE_DEFINITION(mod_curl, mod_curl_load, mod_curl_shutdown, NULL); SWITCH_MODULE_DEFINITION(mod_curl, mod_curl_load, mod_curl_shutdown, NULL);
static char *SYNTAX = "curl url [headers]"; static char *SYNTAX = "curl url [headers|json]";
static struct { static struct {
switch_memory_pool_t *pool; switch_memory_pool_t *pool;
@ -287,7 +287,9 @@ usage:
done: done:
switch_safe_free(stream.data); switch_safe_free(stream.data);
curl_slist_free_all(http_data->headers); if (http_data && http_data->headers) {
curl_slist_free_all(http_data->headers);
}
if (!session) { if (!session) {
switch_core_destroy_memory_pool(&pool); switch_core_destroy_memory_pool(&pool);
} }
@ -356,7 +358,9 @@ usage:
switch_goto_status(status, done); switch_goto_status(status, done);
done: done:
curl_slist_free_all(http_data->headers); if (http_data && http_data->headers) {
curl_slist_free_all(http_data->headers);
}
switch_safe_free(mydata); switch_safe_free(mydata);
if (!session) { if (!session) {
switch_core_destroy_memory_pool(&pool); switch_core_destroy_memory_pool(&pool);