[PATCH] qga-vss: Use a proper function for free memory

Konstantin Kostiuk posted 1 patch 1 week, 1 day ago
qga/vss-win32/requester.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] qga-vss: Use a proper function for free memory
Posted by Konstantin Kostiuk 1 week, 1 day ago
volume_name_wchar is allocated by 'void* operator new [](long long unsigned int)

Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
---
 qga/vss-win32/requester.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
index 4513324dd2..b371affeab 100644
--- a/qga/vss-win32/requester.cpp
+++ b/qga/vss-win32/requester.cpp
@@ -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) {
-- 
2.25.1
Re: [PATCH] qga-vss: Use a proper function for free memory
Posted by Paolo Bonzini 1 week ago
Queued, thanks.

Paolo
Re: [PATCH] qga-vss: Use a proper function for free memory
Posted by Marc-André Lureau 1 week, 1 day ago
On Thu, May 12, 2022 at 5:49 PM Konstantin Kostiuk <kkostiuk@redhat.com> wrote:
>
> 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>

> ---
>  qga/vss-win32/requester.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
> index 4513324dd2..b371affeab 100644
> --- a/qga/vss-win32/requester.cpp
> +++ b/qga/vss-win32/requester.cpp
> @@ -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) {
> --
> 2.25.1
>