Received: from eggs.gnu.org ([2001:4830:134:3::10]:53134) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrRj3-0005Gx-87 for qemu-devel@nongnu.org; Mon, 02 Jun 2014 08:52:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WrRix-0003SC-7Q for qemu-devel@nongnu.org; Mon, 02 Jun 2014 08:52:29 -0400 Received: from oxygen.pond.sub.org ([144.76.244.19]:46503) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrRix-0003Rc-10 for qemu-devel@nongnu.org; Mon, 02 Jun 2014 08:52:23 -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> <87mwdv4jiw.fsf@blackfin.pond.sub.org> <1401711235.2875.121.camel@localhost.localdomain> Date: Mon, 02 Jun 2014 14:52:20 +0200 In-Reply-To: <1401711235.2875.121.camel@localhost.localdomain> (Marcel Apfelbaum's message of "Mon, 02 Jun 2014 15:13:55 +0300") Message-ID: <871tv7a2yj.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: qemu-devel@nongnu.org, Luiz Capitulino , Eduardo Habkost , Andreas =?utf-8?Q?F=C3=A4rber?= Marcel Apfelbaum writes: > On Mon, 2014-06-02 at 13:51 +0200, Markus Armbruster wrote: >> Marcel Apfelbaum writes: >>=20 >> > 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 ch= ar *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 >>=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. > > You are right! My bad, for some reason I saw g_free(value), but it > was me not reading it right :(. Happens :) Reviewed-by: Markus Armbruster