From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37474) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrTIM-0000AM-M9 for qemu-devel@nongnu.org; Mon, 02 Jun 2014 10:33:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WrTIH-0007H5-Ov for qemu-devel@nongnu.org; Mon, 02 Jun 2014 10:33:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39215) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrTIH-0007Gx-G3 for qemu-devel@nongnu.org; Mon, 02 Jun 2014 10:32:57 -0400 Message-ID: <1401719585.2875.127.camel@localhost.localdomain> From: Marcel Apfelbaum Date: Mon, 02 Jun 2014 17:33:05 +0300 In-Reply-To: <871tv7a2yj.fsf@blackfin.pond.sub.org> 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> <871tv7a2yj.fsf@blackfin.pond.sub.org> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 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: Markus Armbruster Cc: qemu-devel@nongnu.org, Luiz Capitulino , Eduardo Habkost , Andreas =?ISO-8859-1?Q?F=E4rber?= On Mon, 2014-06-02 at 14:52 +0200, Markus Armbruster wrote: > Marcel Apfelbaum writes: >=20 > > 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, cons= t char *value, Error **errp) > >> >> { > >> >> MachineState *ms =3D MACHINE(obj); > >> >> =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. > > > > You are right! My bad, for some reason I saw g_free(value), but it > > was me not reading it right :(. >=20 > Happens :) >=20 > Reviewed-by: Markus Armbruster Yes indeed. Reviewed-by: Marcel Apfelbaum