From: Jim Meyering Date: Wed, 20 Jan 2010 17:24:47 +0000 (+0100) Subject: qemuMonitorTextGetMemoryStats: plug a leak on an error path X-Git-Tag: v0.7.6~64 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9827e0a42cccf8046709e4199ef11f2fc8ae8f3d;p=thirdparty%2Flibvirt.git qemuMonitorTextGetMemoryStats: plug a leak on an error path * src/qemu/qemu_monitor_text.c (qemuMonitorCommandWithHandler): Always free *reply, upon failure. --- diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index 0909b4da3d..ce5349bd71 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -1,7 +1,7 @@ /* * qemu_monitor_text.c: interaction with QEMU monitor console * - * Copyright (C) 2006-2009 Red Hat, Inc. + * Copyright (C) 2006-2010 Red Hat, Inc. * Copyright (C) 2006 Daniel P. Berrange * * This library is free software; you can redistribute it and/or @@ -235,9 +235,11 @@ qemuMonitorCommandWithHandler(qemuMonitorPtr mon, } } - if (ret < 0) + if (ret < 0) { virReportSystemError(NULL, msg.lastErrno, _("cannot send monitor command '%s'"), cmd); + VIR_FREE(*reply); + } return ret; }