]> xenbits.xensource.com Git - people/dariof/libvirt.git/commitdiff
storage: fix bogus target in gluster volume xml
authorEric Blake <eblake@redhat.com>
Thu, 19 Dec 2013 04:35:35 +0000 (21:35 -0700)
committerEric Blake <eblake@redhat.com>
Thu, 19 Dec 2013 16:17:11 +0000 (09:17 -0700)
Commit 6cd60b6 was flat out broken - it tried to print into the
wrong variable.  My testing was obviously too cursory (did the
name get a slash added?); valgrind would have caught the error.
Thankfully it didn't hit any release.

Reported by Peter Krempa.

* src/storage/storage_backend_gluster.c
(virStorageBackendGlusterRefreshVol): Fix bogus code.

Signed-off-by: Eric Blake <eblake@redhat.com>
src/storage/storage_backend_gluster.c

index 622526bb478ba3126cf610c1f98f555359351561..2ec2424f88f1d5bcc32180f0e3852fcdd77c89c4 100644 (file)
@@ -227,14 +227,16 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state,
         goto cleanup;
 
     tmp = state->uri->path;
-    if (virAsprintf(&vol->key, "%s%s", state->uri->path, name) < 0) {
+    if (virAsprintf(&state->uri->path, "/%s", vol->key) < 0) {
         state->uri->path = tmp;
         goto cleanup;
     }
     if (!(vol->target.path = virURIFormat(state->uri))) {
+        VIR_FREE(state->uri->path);
         state->uri->path = tmp;
         goto cleanup;
     }
+    VIR_FREE(state->uri->path);
     state->uri->path = tmp;
 
     if (S_ISDIR(st->st_mode)) {