# HG changeset patch # User Mike Becker # Date 1504176909 -7200 # Node ID cd3846cc8b253d5c6826b3b90ff8e11939f9f438 # Parent 99bcd7915a0db3f7880fa86efbc8ad9e8da1f567 fixes memory leaks detected by cppcheck (or annotates them at least) diff -r 99bcd7915a0d -r cd3846cc8b25 dav/scfg.c --- a/dav/scfg.c Thu Aug 31 12:44:25 2017 +0200 +++ b/dav/scfg.c Thu Aug 31 12:55:09 2017 +0200 @@ -84,6 +84,7 @@ if (regcomp(regex, value, REG_EXTENDED|REG_NOSUB)) { print_warning(xmlline, "Invalid regular expression (%s) ... skipped\n", value); + free(regex); return list; } else { return ucx_list_append(list, regex); diff -r 99bcd7915a0d -r cd3846cc8b25 dav/sync.c --- a/dav/sync.c Thu Aug 31 12:44:25 2017 +0200 +++ b/dav/sync.c Thu Aug 31 12:55:09 2017 +0200 @@ -1001,13 +1001,7 @@ resources = ucx_list_append(resources, res); } } else if(!sstrcmp(name, S("remove"))) { - LocalResource *res = calloc(1, sizeof(LocalResource)); - res->path = sstrdup(value).ptr; - if(res) { - //ucx_map_sstr_put(db->remove, value, res); - ucx_map_sstr_remove(db->resources, value); - } - + ucx_map_sstr_remove(db->resources, value); } free(value.ptr); diff -r 99bcd7915a0d -r cd3846cc8b25 libidav/davqlparser.c --- a/libidav/davqlparser.c Thu Aug 31 12:44:25 2017 +0200 +++ b/libidav/davqlparser.c Thu Aug 31 12:55:09 2017 +0200 @@ -419,6 +419,7 @@ ln, pn).ptr; } +// TODO: this macro results in a memory leak - we return without freeing memory #define dqlsec_alloc_failed(ptr, stmt) \ if (!(ptr)) { \ (stmt)->errorcode = DAVQL_ERROR_OUT_OF_MEMORY; \