dav/main.c

changeset 74
da079dc0724c
parent 73
41e88442ad4e
child 75
56962faf2b42
--- a/dav/main.c	Thu Jan 29 11:43:41 2015 +0100
+++ b/dav/main.c	Sun Feb 08 16:36:32 2015 +0100
@@ -61,7 +61,6 @@
     ctx = dav_context_new();
     load_config(ctx);
     //dav_add_namespace(ctx, "U", "http://www.uap-core.de/");
-    
     //test();
     
     memcpy(ctx->http_proxy, get_http_proxy(), sizeof(Proxy));
@@ -77,6 +76,7 @@
     CmdArgs *args = cmd_parse_args(argc - 2, argv + 2);
     if(!args) {
         print_usage(argv[0]);
+        cmd_args_free(args);
         return -1;
     }
     
@@ -104,7 +104,12 @@
     } else {
         print_usage(argv[0]);
     }
+    
     dav_context_destroy(ctx);
+    cmd_args_free(args);
+    free_config();
+    xmlCleanupParser();
+    curl_global_cleanup();
     
     return ret;
 }
@@ -364,6 +369,8 @@
     free(path);
     //free(base);
     
+    dav_session_destroy(sn);
+    
     return ret;
 }
 
@@ -585,6 +592,7 @@
     
     int ret = get_resource(repo, res, a, outfile);
     
+    free(path);
     return ret;
 }
 
@@ -677,6 +685,7 @@
         ret = put_entry(repo, a, sn, path, file); 
     }
     
+    free(path);
     return ret;
 }
 
@@ -756,9 +765,9 @@
     } else if(res->iscollection) {
         // TODO: free res
         char *newpath = util_concat_path(path, name);
-        free(path);
         path = newpath;
         res = dav_resource_new(sn, path);
+        free(newpath);
         int ret = put_file(repo, a, sn, res->path, NULL, in);
         // TODO: free res
         return ret;
@@ -805,6 +814,7 @@
         return -1;
     }
     
+    free(path);
     return 0;
 }
 
@@ -849,6 +859,7 @@
         return -1;
     }
     
+    free(path);
     return 0;
 }
 
@@ -888,6 +899,7 @@
         } else {
             return -1;
         }
+        free(path);
         return 0;
     } else {
         fprintf(stderr, "Too many arguments\n");
@@ -936,6 +948,7 @@
         ret = -1;
     }
     
+    free(path);
     return ret;
 }
 
@@ -975,6 +988,7 @@
         return -1;
     }
     
+    free(path);
     return 0;
 }
 

mercurial