[libvirt] [PATCH] qemuMonitorTextMigrate: avoid leak on OOM-error path

Daniel P. Berrange berrange at redhat.com
Tue May 18 15:07:52 UTC 2010


On Tue, May 18, 2010 at 05:01:16PM +0200, Jim Meyering wrote:
> Oops.  Nearly forgot to post this one:
> 
> >From f1b58f1f7bd287b4a2157f62ebb63100b45a8b62 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering at redhat.com>
> Date: Tue, 18 May 2010 12:17:23 +0200
> Subject: [PATCH] qemuMonitorTextMigrate: avoid leak on OOM-error path
> 
> * src/qemu/qemu_monitor_text.c (qemuMonitorTextMigrate): Also
> free "safedest" buffer when failing.
> ---
>  src/qemu/qemu_monitor_text.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
> index ae5d4d2..ec3d69d 100644
> --- a/src/qemu/qemu_monitor_text.c
> +++ b/src/qemu/qemu_monitor_text.c
> @@ -1149,6 +1149,7 @@ static int qemuMonitorTextMigrate(qemuMonitorPtr mon,
>      if (virBufferError(&extra)) {
>          virBufferFreeAndReset(&extra);
>          virReportOOMError();
> +        free(safedest);
>          return -1;
>      }
>      if (virAsprintf(&cmd, "migrate %s\"%s\"", virBufferContentAndReset(&extra), safedest) < 0) {

Hmm, I'm sure I saw this posted yesterday, but ACK 

Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list