Received: from eggs.gnu.org ([2001:4830:134:3::10]:37337) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrQlj-0008TC-St for qemu-devel@nongnu.org; Mon, 02 Jun 2014 07:51:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WrQld-0003F3-Me for qemu-devel@nongnu.org; Mon, 02 Jun 2014 07:51:11 -0400 Received: from oxygen.pond.sub.org ([144.76.244.19]:46411) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrQld-0003Ev-Gb for qemu-devel@nongnu.org; Mon, 02 Jun 2014 07:51:05 -0400 From: Markus Armbruster References: <1401480140-18653-1-git-send-email-ehabkost@redhat.com> <1401480140-18653-4-git-send-email-ehabkost@redhat.com> <1401611157.2875.97.camel@localhost.localdomain> Date: Mon, 02 Jun 2014 13:51:03 +0200 In-Reply-To: <1401611157.2875.97.camel@localhost.localdomain> (Marcel Apfelbaum's message of "Sun, 01 Jun 2014 11:25:57 +0300") Message-ID: <87mwdv4jiw.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 3/3] hw/machine: Free old values of string properties List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcel Apfelbaum Cc: Luiz Capitulino , Eduardo Habkost , Andreas =?utf-8?Q?F=C3=A4?= =?utf-8?Q?rber?= , qemu-devel@nongnu.org Marcel Apfelbaum writes: > On Fri, 2014-05-30 at 17:02 -0300, Eduardo Habkost wrote: >> Signed-off-by: Eduardo Habkost >> --- >> Cc: Marcel Apfelbaum >> Cc: Andreas F=C3=A4rber >> --- >> hw/core/machine.c | 8 ++++++++ >> 1 file changed, 8 insertions(+) >>=20 >> diff --git a/hw/core/machine.c b/hw/core/machine.c >> index cbba679..df612bb 100644 >> --- a/hw/core/machine.c >> +++ b/hw/core/machine.c >> @@ -24,6 +24,7 @@ static void machine_set_accel(Object *obj, const char = *value, Error **errp) >> { >> MachineState *ms =3D MACHINE(obj); >>=20=20 >> + g_free(ms->accel); > I am not sure if in QMP is not caller's responsibility to free the input = string. > If I think about it, I ask an object to set "my" string and it deletes it= :(... > Same for the others. > > Added Markus and Luiz, maybe they have an opinion on that. > >> ms->accel =3D g_strdup(value); >> } >>=20=20 Misunderstanding? Eduardo's patch frees the old value before it overwrites it. It doesn't free "the input string", assuming by "the input string" you mean argument value.