From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43863) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrR7j-0000GH-8j for qemu-devel@nongnu.org; Mon, 02 Jun 2014 08:14:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WrR7e-0004kL-5f for qemu-devel@nongnu.org; Mon, 02 Jun 2014 08:13:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57080) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrR7d-0004kB-Tz for qemu-devel@nongnu.org; Mon, 02 Jun 2014 08:13:50 -0400 Message-ID: <1401711235.2875.121.camel@localhost.localdomain> From: Marcel Apfelbaum Date: Mon, 02 Jun 2014 15:13:55 +0300 In-Reply-To: <87mwdv4jiw.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> 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: Luiz Capitulino , Eduardo Habkost , Andreas =?ISO-8859-1?Q?F=E4rber?= , qemu-devel@nongnu.org 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 c= har *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 in= put string. > > If I think about it, I ask an object to set "my" string and it delete= s 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 :(. Thanks, Marcel