fixes definite chance of a memory leak in cmd_unlock() + marks a further possible source of memory leaks

Wed, 30 May 2018 10:22:33 +0200

author
Mike Becker <universe@uap-core.de>
date
Wed, 30 May 2018 10:22:33 +0200
changeset 384
8bfde5687890
parent 383
bc215bdaf9bc
child 385
85d5049f694b

fixes definite chance of a memory leak in cmd_unlock() + marks a further possible source of memory leaks

dav/main.c file | annotate | diff | comparison | revisions
--- a/dav/main.c	Wed May 30 10:12:51 2018 +0200
+++ b/dav/main.c	Wed May 30 10:22:33 2018 +0200
@@ -181,8 +181,9 @@
     NULL
 };
 
-char* find_usage_str(char *cmd) {
-    sstr_t c = sstr(cmd);
+char* find_usage_str(const char *cmd) {
+    // TODO: use scstr_t after UCX update
+    sstr_t c = sstr((char*)cmd);
     for(int i=0;;i++) {
         char *str = cmdusageinfo[i];
         if(!str) {
@@ -313,6 +314,8 @@
     if(repo) {
         *path = sstrdup(p).ptr;
     } else {
+        // TODO: who is responsible for freeing this repository?
+        // how can the callee know, if he has to call free()?
         repo = calloc(1, sizeof(Repository));
         repo->name = strdup("");
         repo->decrypt_content = true;
@@ -1655,7 +1658,6 @@
     
     char *url = a->argv[0];
     char *path = NULL;
-    Repository *repo = url2repo(url, &path);
     DavSession *sn = connect_to_repo(url2repo(url, &path), a);
     ucx_mempool_reg_destr(sn->mp, path, free);
     if(set_session_config(sn, a)) {

mercurial