summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOBATA Akio <[email protected]>2020-02-03 11:40:27 +0900
committerMichele Calgaro <[email protected]>2020-02-05 21:03:17 +0900
commit656bafb6e9e4d716bee1bab0d6fa902f341f75e9 (patch)
treead6dd3d084cf604e168da547ca58003fe65ad91c
parent7d1525c981b40350e5e92bed446522d1b4ae72d8 (diff)
downloadlibcarddav-656bafb6e9e4d716bee1bab0d6fa902f341f75e9.tar.gz
libcarddav-656bafb6e9e4d716bee1bab0d6fa902f341f75e9.zip
Remove unwanted memory allocation for response
It is expected as pointer to struct response with size of the struct, not pointer to the pointer, but never returned to caller. It should be allocated by caller. Signed-off-by: OBATA Akio <[email protected]> (cherry picked from commit 8d21538ce07e8c91023fd8d4997563d7db156ed6)
-rw-r--r--src/carddav.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/carddav.c b/src/carddav.c
index aeb0ad5..92e6362 100644
--- a/src/carddav.c
+++ b/src/carddav.c
@@ -425,12 +425,9 @@ CARDDAV_RESPONSE carddav_get_object(response *result,
CARDDAV_RESPONSE carddav_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_carddav_settings(&settings);
settings.ACTION = GET;
settings.start = start;
@@ -489,12 +486,9 @@ CARDDAV_RESPONSE carddav_getall_object(response* result,
CARDDAV_RESPONSE carddav_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_carddav_settings(&settings);
settings.ACTION = GETALL;
if (info->options->debug)
@@ -553,12 +547,9 @@ CARDDAV_RESPONSE carddav_getall_object_by_uri(response* result,
CARDDAV_RESPONSE carddav_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_carddav_settings(&settings);
settings.ACTION = GETALL;
if (info->options->debug)
@@ -616,12 +607,9 @@ CARDDAV_RESPONSE carddav_get_displayname(response* result,
CARDDAV_RESPONSE carddav_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_carddav_settings(&settings);
settings.ACTION = GETCALNAME;
if (info->options->debug)