summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOBATA Akio <obache@wizdas.com>2020-02-09 17:57:53 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2020-02-09 18:48:03 +0900
commit79db21120c75d9da899303bf0c08758b1fa07456 (patch)
treede763fcd20615d76603d1e78c3f4bd39feec3861
parent182a91ec03e503be315414e42a0dc49415c09df8 (diff)
downloadlibcaldav-79db21120c75d9da899303bf0c08758b1fa07456.tar.gz
libcaldav-79db21120c75d9da899303bf0c08758b1fa07456.zip
Remove unwanted memory allocation for response
It is expected as pointer to struct response with size fo the struct, not pointer to the pointer, but never returned to the caller. It should be allocated by the caller. Signed-off-by: OBATA Akio <obache@wizdas.com> (cherry picked from commit 9578e366c28fa0e4f17202d90260a68e941c8f21)
-rw-r--r--src/caldav.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/src/caldav.c b/src/caldav.c
index 9e2b0af..a097946 100644
--- a/src/caldav.c
+++ b/src/caldav.c
@@ -301,12 +301,9 @@ CALDAV_RESPONSE caldav_get_object(response *result,
CALDAV_RESPONSE caldav_response;
g_return_val_if_fail(info != NULL, TRUE);
+ g_return_val_if_fail(result != NULL, NOTIMPLEMENTED);
init_runtime(info);
- if (!result) {
- result = malloc(sizeof(response *));
- memset(result, '\0', sizeof(response *));
- }
init_caldav_settings(&settings);
settings.ACTION = GET;
settings.start = start;
@@ -365,12 +362,9 @@ CALDAV_RESPONSE caldav_getall_object(response* result,
CALDAV_RESPONSE caldav_response;
g_return_val_if_fail(info != NULL, TRUE);
+ g_return_val_if_fail(result != NULL, NOTIMPLEMENTED);
init_runtime(info);
- if (!result) {
- result = malloc(sizeof(response *));
- memset(result, '\0', sizeof(response *));
- }
init_caldav_settings(&settings);
settings.ACTION = GETALL;
if (info->options->debug)
@@ -547,12 +541,9 @@ CALDAV_RESPONSE caldav_tasks_get_object(response *result,
CALDAV_RESPONSE caldav_response;
g_return_val_if_fail(info != NULL, TRUE);
+ g_return_val_if_fail(result != NULL, NOTIMPLEMENTED);
init_runtime(info);
- if (!result) {
- result = malloc(sizeof(response *));
- memset(result, '\0', sizeof(response *));
- }
init_caldav_settings(&settings);
settings.ACTION = GETTASKS;
settings.start = start;
@@ -611,12 +602,9 @@ CALDAV_RESPONSE caldav_tasks_getall_object(response* result,
CALDAV_RESPONSE caldav_response;
g_return_val_if_fail(info != NULL, TRUE);
+ g_return_val_if_fail(result != NULL, NOTIMPLEMENTED);
init_runtime(info);
- if (!result) {
- result = malloc(sizeof(response *));
- memset(result, '\0', sizeof(response *));
- }
init_caldav_settings(&settings);
settings.ACTION = GETALLTASKS;
if (info->options->debug)
@@ -673,12 +661,9 @@ CALDAV_RESPONSE caldav_get_displayname(response* result,
CALDAV_RESPONSE caldav_response;
g_return_val_if_fail(info != NULL, TRUE);
+ g_return_val_if_fail(result != NULL, NOTIMPLEMENTED);
init_runtime(info);
- if (!result) {
- result = malloc(sizeof(response *));
- memset(result, '\0', sizeof(response *));
- }
init_caldav_settings(&settings);
settings.ACTION = GETCALNAME;
if (info->options->debug)
@@ -788,12 +773,9 @@ CALDAV_RESPONSE caldav_get_freebusy(response *result,
CALDAV_RESPONSE caldav_response;
g_return_val_if_fail(info != NULL, TRUE);
+ g_return_val_if_fail(result != NULL, NOTIMPLEMENTED);
init_runtime(info);
- if (!result) {
- result = malloc(sizeof(response *));
- memset(result, '\0', sizeof(response *));
- }
init_caldav_settings(&settings);
settings.ACTION = FREEBUSY;
settings.start = start;