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 9578e366c2)
r14.0.x
OBATA Akio 5 years ago committed by Michele Calgaro
parent 182a91ec03
commit 79db21120c
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -301,12 +301,9 @@ CALDAV_RESPONSE caldav_get_object(response *result,
CALDAV_RESPONSE caldav_response; CALDAV_RESPONSE caldav_response;
g_return_val_if_fail(info != NULL, TRUE); g_return_val_if_fail(info != NULL, TRUE);
g_return_val_if_fail(result != NULL, NOTIMPLEMENTED);
init_runtime(info); init_runtime(info);
if (!result) {
result = malloc(sizeof(response *));
memset(result, '\0', sizeof(response *));
}
init_caldav_settings(&settings); init_caldav_settings(&settings);
settings.ACTION = GET; settings.ACTION = GET;
settings.start = start; settings.start = start;
@ -365,12 +362,9 @@ CALDAV_RESPONSE caldav_getall_object(response* result,
CALDAV_RESPONSE caldav_response; CALDAV_RESPONSE caldav_response;
g_return_val_if_fail(info != NULL, TRUE); g_return_val_if_fail(info != NULL, TRUE);
g_return_val_if_fail(result != NULL, NOTIMPLEMENTED);
init_runtime(info); init_runtime(info);
if (!result) {
result = malloc(sizeof(response *));
memset(result, '\0', sizeof(response *));
}
init_caldav_settings(&settings); init_caldav_settings(&settings);
settings.ACTION = GETALL; settings.ACTION = GETALL;
if (info->options->debug) if (info->options->debug)
@ -547,12 +541,9 @@ CALDAV_RESPONSE caldav_tasks_get_object(response *result,
CALDAV_RESPONSE caldav_response; CALDAV_RESPONSE caldav_response;
g_return_val_if_fail(info != NULL, TRUE); g_return_val_if_fail(info != NULL, TRUE);
g_return_val_if_fail(result != NULL, NOTIMPLEMENTED);
init_runtime(info); init_runtime(info);
if (!result) {
result = malloc(sizeof(response *));
memset(result, '\0', sizeof(response *));
}
init_caldav_settings(&settings); init_caldav_settings(&settings);
settings.ACTION = GETTASKS; settings.ACTION = GETTASKS;
settings.start = start; settings.start = start;
@ -611,12 +602,9 @@ CALDAV_RESPONSE caldav_tasks_getall_object(response* result,
CALDAV_RESPONSE caldav_response; CALDAV_RESPONSE caldav_response;
g_return_val_if_fail(info != NULL, TRUE); g_return_val_if_fail(info != NULL, TRUE);
g_return_val_if_fail(result != NULL, NOTIMPLEMENTED);
init_runtime(info); init_runtime(info);
if (!result) {
result = malloc(sizeof(response *));
memset(result, '\0', sizeof(response *));
}
init_caldav_settings(&settings); init_caldav_settings(&settings);
settings.ACTION = GETALLTASKS; settings.ACTION = GETALLTASKS;
if (info->options->debug) if (info->options->debug)
@ -673,12 +661,9 @@ CALDAV_RESPONSE caldav_get_displayname(response* result,
CALDAV_RESPONSE caldav_response; CALDAV_RESPONSE caldav_response;
g_return_val_if_fail(info != NULL, TRUE); g_return_val_if_fail(info != NULL, TRUE);
g_return_val_if_fail(result != NULL, NOTIMPLEMENTED);
init_runtime(info); init_runtime(info);
if (!result) {
result = malloc(sizeof(response *));
memset(result, '\0', sizeof(response *));
}
init_caldav_settings(&settings); init_caldav_settings(&settings);
settings.ACTION = GETCALNAME; settings.ACTION = GETCALNAME;
if (info->options->debug) if (info->options->debug)
@ -788,12 +773,9 @@ CALDAV_RESPONSE caldav_get_freebusy(response *result,
CALDAV_RESPONSE caldav_response; CALDAV_RESPONSE caldav_response;
g_return_val_if_fail(info != NULL, TRUE); g_return_val_if_fail(info != NULL, TRUE);
g_return_val_if_fail(result != NULL, NOTIMPLEMENTED);
init_runtime(info); init_runtime(info);
if (!result) {
result = malloc(sizeof(response *));
memset(result, '\0', sizeof(response *));
}
init_caldav_settings(&settings); init_caldav_settings(&settings);
settings.ACTION = FREEBUSY; settings.ACTION = FREEBUSY;
settings.start = start; settings.start = start;

Loading…
Cancel
Save