added cleanup code in cmd_add_repository

Sat, 27 Feb 2016 19:53:43 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 27 Feb 2016 19:53:43 +0100
changeset 197
79a866256be4
parent 196
f7b0e6450aa9
child 198
44054c452de1

added cleanup code in cmd_add_repository

dav/main.c file | annotate | diff | comparison | revisions
--- a/dav/main.c	Sat Feb 27 19:47:55 2016 +0100
+++ b/dav/main.c	Sat Feb 27 19:53:43 2016 +0100
@@ -121,7 +121,7 @@
         ret = cmd_get_property(args);
     } else if(!strcasecmp(cmd, "info")) {
         ret = cmd_info(args);
-    } else if(!strcasecmp(cmd, "create-repository")) {
+    } else if(!strcasecmp(cmd, "add-repository")) {
         ret = cmd_add_repository(args);
     } else if(!strcasecmp(cmd, "version") || !strcasecmp(cmd, "-version") || !strcasecmp(cmd, "--version")) {
 #ifdef DEBUG
@@ -1160,8 +1160,6 @@
 /* ---------- config commands ---------- */
 
 int cmd_add_repository(CmdArgs *args) {
-    sstr_t line;
-    
     printf("Each repository must have an unique name.\n");
     char *name = assistant_getcfg("name");
     if(!name) {
@@ -1204,5 +1202,14 @@
         printf("Added repository: %s (%s)\n", name, url);
     }
     
+    free(name);
+    free(url);
+    if(user) {
+        free(user);
+    }
+    if(password) {
+        free(password);
+    }
+    
     return ret;
 }

mercurial