fixes memory leak in cmd_move()

Wed, 30 May 2018 10:07:48 +0200

author
Mike Becker <universe@uap-core.de>
date
Wed, 30 May 2018 10:07:48 +0200
changeset 382
1ce7211a1021
parent 381
17ccf828a2f2
child 383
bc215bdaf9bc

fixes memory leak in cmd_move()

dav/main.c file | annotate | diff | comparison | revisions
--- a/dav/main.c	Tue May 29 20:38:22 2018 +0200
+++ b/dav/main.c	Wed May 30 10:07:48 2018 +0200
@@ -218,7 +218,7 @@
             "        -R         "
             "Recursively do the operation for all children\n");
     fprintf(stderr, "        -K         Keep already present files\n");
-    fprintf(stderr, "        -o <file>  Write output to file\n");
+    fprintf(stderr, "        -o <file>  Write output to file (use '-' for stdout)\n");
     fprintf(
             stderr,
             "        -u <date>  "
@@ -1310,10 +1310,6 @@
     char *path1 = NULL;
     Repository *repo1 = url2repo(url1, &path1);
     
-    char *url2 = a->argv[1];
-    char *path2 = NULL;
-    Repository *repo2 = url2repo(url2, &path2);
-    
     DavSession *sn = connect_to_repo(repo1, a);
     if(set_session_config(sn, a)) {
         return -1;
@@ -1322,6 +1318,10 @@
     
     DavBool override = cmd_getoption(a, "override") ? true : false;
     
+    char *url2 = a->argv[1];
+    char *path2 = NULL;
+    Repository *repo2 = url2repo(url2, &path2);
+    
     if(repo1 == repo2) {
         DavResource *res = dav_resource_new(sn, path1);
         int err = cp ? dav_copy_o(res, path2, override)

mercurial