diary

Text-based journaling program
git clone https://git.in0rdr.ch/diary.git
Log | Files | Refs | Pull requests | README | LICENSE

commit 8604d4895b93cf133b74b89a821db223efdbe98e
parent 2338a22b274c44264b5c2472d60778f716e76b44
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date:   Sat, 31 Aug 2024 19:55:11 +0200

fix: free URL handle

Diffstat:
Msrc/caldav.c | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/caldav.c b/src/caldav.c @@ -1,6 +1,6 @@ #include "caldav.h" -CURL *curl; +CURL* curl; char access_token[sizeof(char)*2048] = ""; char refresh_token[sizeof(char)*512] = ""; int token_ttl = 0; @@ -25,7 +25,7 @@ void random_code_challenge(size_t len, char* dest) { dest[len] = '\0'; } -static size_t curl_write_mem_callback(void * contents, size_t size, size_t nmemb, void *userp) { +static size_t curl_write_mem_callback(void* contents, size_t size, size_t nmemb, void* userp) { size_t realsize = size * nmemb; struct curl_mem_chunk* mem = (struct curl_mem_chunk*)userp; @@ -45,7 +45,7 @@ static size_t curl_write_mem_callback(void * contents, size_t size, size_t nmemb // todo // https://beej.us/guide/bgnet/html -void* get_in_addr(struct sockaddr *sa) { +void* get_in_addr(struct sockaddr* sa) { if (sa->sa_family == AF_INET) { return &(((struct sockaddr_in*)sa)->sin_addr); } @@ -780,6 +780,7 @@ int caldav_sync(struct tm* date, if (!uc) { tracepoint(diary, error, "cur_url_get() failed in caldav_sync()"); } + curl_url_cleanup(h); // get the home-set of the user char uri[300]; @@ -832,6 +833,7 @@ int caldav_sync(struct tm* date, // get calendar URI from the home-set char* calendar_href = parse_caldav_calendar(calendar_xml, CONFIG.caldav_calendar); + free(calendar_xml); char* xml_filter = "<c:calendar-query xmlns:d='DAV:' xmlns:c='urn:ietf:params:xml:ns:caldav'>" "<d:prop><d:getetag/><c:calendar-data/></d:prop>"