OSDN Git Service

qga-vss: Use the proper operator to free memory
authorKonstantin Kostiuk <kkostiuk@redhat.com>
Thu, 12 May 2022 15:49:09 +0000 (18:49 +0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 14 May 2022 10:32:41 +0000 (12:32 +0200)
volume_name_wchar is allocated by 'void* operator new [](long long unsigned int)

Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220512154909.331481-1-kkostiuk@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qga/vss-win32/requester.cpp

index 4513324..b371aff 100644 (file)
@@ -354,12 +354,12 @@ void requester_freeze(int *num_vols, void *mountpoints, ErrorSet *errset)
             if (FAILED(hr)) {
                 err_set(errset, hr, "failed to add %S to snapshot set",
                         volume_name_wchar);
-                delete volume_name_wchar;
+                delete[] volume_name_wchar;
                 goto out;
             }
             num_mount_points++;
 
-            delete volume_name_wchar;
+            delete[] volume_name_wchar;
         }
 
         if (num_mount_points == 0) {