Fix a variety of memory leaks
[asterisk/asterisk.git] / res / res_calendar_exchange.c
index 2238124..e7beeaf 100644 (file)
@@ -24,7 +24,9 @@
        <depend>neon</depend>
        <depend>ical</depend>
        <depend>iksemel</depend>
        <depend>neon</depend>
        <depend>ical</depend>
        <depend>iksemel</depend>
+       <support_level>core</support_level>
 ***/
 ***/
+
 #include "asterisk.h"
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk.h"
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
@@ -431,9 +433,8 @@ static int exchangecal_write_event(struct ast_calendar_event *event)
                return -1;
        }
        if (!(body = ast_str_create(512)) ||
                return -1;
        }
        if (!(body = ast_str_create(512)) ||
-               !(subdir = ast_str_create(32)) ||
-               !(response = ast_str_create(512))) {
-               ast_log(LOG_ERROR, "Could not allocate memory for request and response!\n");
+               !(subdir = ast_str_create(32))) {
+               ast_log(LOG_ERROR, "Could not allocate memory for request!\n");
                goto write_cleanup;
        }
 
                goto write_cleanup;
        }
 
@@ -503,9 +504,10 @@ static int exchangecal_write_event(struct ast_calendar_event *event)
        ast_verb(0, "\n\n%s\n\n", ast_str_buffer(body));
        ast_str_set(&subdir, 0, "/Calendar/%s.eml", ast_str_buffer(uid));
 
        ast_verb(0, "\n\n%s\n\n", ast_str_buffer(body));
        ast_str_set(&subdir, 0, "/Calendar/%s.eml", ast_str_buffer(uid));
 
-       response = exchangecal_request(event->owner->tech_pvt, "PROPPATCH", body, subdir);
+       if ((response = exchangecal_request(event->owner->tech_pvt, "PROPPATCH", body, subdir))) {
+               ret = 0;
+       }
 
 
-       ret = 0;
 write_cleanup:
        if (uid) {
                ast_free(uid);
 write_cleanup:
        if (uid) {
                ast_free(uid);