[libvirt] [PATCH 14/34] Fixed char device stuff
Daniel P. Berrange
berrange at redhat.com
Mon Jan 18 11:38:26 UTC 2010
On Fri, Jan 15, 2010 at 04:17:44PM +0100, Daniel Veillard wrote:
> On Fri, Jan 08, 2010 at 05:23:10PM +0000, Daniel P. Berrange wrote:
> > Temp hack
> > ---
> > src/qemu/qemu_monitor_text.c | 9 +++------
> > 1 files changed, 3 insertions(+), 6 deletions(-)
> >
> > diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
> > index 52cd97c..2b8c1e8 100644
> > --- a/src/qemu/qemu_monitor_text.c
> > +++ b/src/qemu/qemu_monitor_text.c
> > @@ -1678,14 +1678,12 @@ cleanup:
> > int qemuMonitorTextGetPtyPaths(qemuMonitorPtr mon,
> > virHashTablePtr paths)
> > {
> > - const char *cmd = "info chardev";
> > char *reply = NULL;
> > int ret = -1;
> >
> > - if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
> > - qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
> > - _("failed to retrieve chardev info in qemu with '%s'"),
> > - cmd);
> > + if (qemuMonitorCommand(mon, "info chardev", &reply) < 0) {
> > + qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, "%s",
> > + _("failed to retrieve chardev info in qemu with 'info chardev'"));
> > goto cleanup;
> > }
> >
> > @@ -1747,7 +1745,6 @@ int qemuMonitorTextGetPtyPaths(qemuMonitorPtr mon,
> > ret = 0;
> >
> > cleanup:
> > - VIR_FREE(cmd);
> > VIR_FREE(reply);
> > return ret;
> > }
>
> Looks strictly equivalent, ACK,
Sorry, this commit message should not have been left like this. There is
one subtle difference. The original code is free()ing a 'constant'
string. This is pretty much a guarenteed SEGV in malloc code.
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.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