From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54364) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YblDS-0003Bs-Ai for qemu-devel@nongnu.org; Sat, 28 Mar 2015 03:31:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YblDQ-0006MY-Vi for qemu-devel@nongnu.org; Sat, 28 Mar 2015 03:31:34 -0400 MIME-Version: 1.0 In-Reply-To: <55161404.4000404@huawei.com> References: <1425524720-11376-1-git-send-email-arei.gonglei@huawei.com> <5507D480.1000505@huawei.com> <55161404.4000404@huawei.com> Date: Sat, 28 Mar 2015 17:31:32 +1000 Message-ID: From: "Edgar E. Iglesias" Content-Type: multipart/alternative; boundary=001a1140f794ecc7840512543c8b Subject: Re: [Qemu-devel] [PATCH v2] microblaze: fix memory leak List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gonglei Cc: qemu-trivial@nongnu.org, Peter Maydell , Michael Tokarev , qemu-devel@nongnu.org, "pbonzini@redhat.com" --001a1140f794ecc7840512543c8b Content-Type: text/plain; charset=UTF-8 On 28/03/2015 12:38 pm, "Gonglei" wrote: > > Hi, > > Ping again... Can this patch be a raw stuff for rc2 ? Looks good to me, thanks. Reviewed-by: Edgar E. Iglesias Can this go through -trivial? Cheers, Edgar > > Regards, > Gonglei > > On 2015/3/17 15:15, Gonglei wrote: > > On 2015/3/5 11:05, arei.gonglei@huawei.com wrote: > >> From: Gonglei > >> > >> When not assign a -dtb argument, the variable dtb_filename > >> storage returned from qemu_find_file(), which should be freed > >> after use. Alternatively we define a local variable filename, > >> with 'char *' type, free after use. > >> > >> Cc: Michael Tokarev > >> Cc: Edgar E. Iglesias > >> Signed-off-by: Gonglei > >> --- > >> v2: fix a complier error. > >> --- > >> hw/microblaze/boot.c | 13 +++++++------ > >> 1 file changed, 7 insertions(+), 6 deletions(-) > >> > > > > Ping... > > > >> diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c > >> index a2843cd..352ccb1 100644 > >> --- a/hw/microblaze/boot.c > >> +++ b/hw/microblaze/boot.c > >> @@ -113,15 +113,15 @@ void microblaze_load_kernel(MicroBlazeCPU *cpu, hwaddr ddr_base, > >> const char *kernel_filename; > >> const char *kernel_cmdline; > >> const char *dtb_arg; > >> + char *filename = NULL; > >> > >> machine_opts = qemu_get_machine_opts(); > >> kernel_filename = qemu_opt_get(machine_opts, "kernel"); > >> kernel_cmdline = qemu_opt_get(machine_opts, "append"); > >> dtb_arg = qemu_opt_get(machine_opts, "dtb"); > >> - if (dtb_arg) { /* Preference a -dtb argument */ > >> - dtb_filename = dtb_arg; > >> - } else { /* default to pcbios dtb as passed by machine_init */ > >> - dtb_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, dtb_filename); > >> + /* default to pcbios dtb as passed by machine_init */ > >> + if (!dtb_arg) { > >> + filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, dtb_filename); > >> } > >> > >> boot_info.machine_cpu_reset = machine_cpu_reset; > >> @@ -203,7 +203,8 @@ void microblaze_load_kernel(MicroBlazeCPU *cpu, hwaddr ddr_base, > >> boot_info.initrd_start, > >> boot_info.initrd_end, > >> kernel_cmdline, > >> - dtb_filename); > >> + /* Preference a -dtb argument */ > >> + dtb_arg ? dtb_arg : filename); > >> } > >> - > >> + g_free(filename); > >> } > >> > > > > --001a1140f794ecc7840512543c8b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

On 28/03/2015 12:38 pm, "Gonglei" <arei.gonglei@huawei.com> wrote:
>
> Hi,
>
> =C2=A0 =C2=A0Ping again...=C2=A0 Can this patch be a raw stuff for rc2= ?

Looks good to me, thanks.

Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>

Can this go through -trivial?

Cheers,
Edgar

>
> Regards,
> Gonglei
>
> On 2015/3/17 15:15, Gonglei wrote:
> > On 2015/3/5 11:05, are= i.gonglei@huawei.com wrote:
> >> From: Gonglei <= arei.gonglei@huawei.com>
> >>
> >> When not assign a -dtb argument, the variable dtb_filename > >> storage returned from qemu_find_file(), which should be freed=
> >> after use. Alternatively we define a local variable filename,=
> >> with 'char *' type, free after use.
> >>
> >> Cc: Michael Tokarev <mjt= @tls.msk.ru>
> >> Cc: Edgar E. Iglesias <edgar.iglesias@gmail.com>
> >> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> >> ---
> >> v2: fix a complier error.
> >> ---
> >>=C2=A0 hw/microblaze/boot.c | 13 +++++++------
> >>=C2=A0 1 file changed, 7 insertions(+), 6 deletions(-)
> >>
> >
> > Ping...
> >
> >> diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c
> >> index a2843cd..352ccb1 100644
> >> --- a/hw/microblaze/boot.c
> >> +++ b/hw/microblaze/boot.c
> >> @@ -113,15 +113,15 @@ void microblaze_load_kernel(MicroBlazeC= PU *cpu, hwaddr ddr_base,
> >>=C2=A0 =C2=A0 =C2=A0 const char *kernel_filename;
> >>=C2=A0 =C2=A0 =C2=A0 const char *kernel_cmdline;
> >>=C2=A0 =C2=A0 =C2=A0 const char *dtb_arg;
> >> +=C2=A0 =C2=A0 char *filename =3D NULL;
> >>
> >>=C2=A0 =C2=A0 =C2=A0 machine_opts =3D qemu_get_machine_opts();=
> >>=C2=A0 =C2=A0 =C2=A0 kernel_filename =3D qemu_opt_get(machine_= opts, "kernel");
> >>=C2=A0 =C2=A0 =C2=A0 kernel_cmdline =3D qemu_opt_get(machine_o= pts, "append");
> >>=C2=A0 =C2=A0 =C2=A0 dtb_arg =3D qemu_opt_get(machine_opts, &q= uot;dtb");
> >> -=C2=A0 =C2=A0 if (dtb_arg) { /* Preference a -dtb argument *= /
> >> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 dtb_filename =3D dtb_arg;
> >> -=C2=A0 =C2=A0 } else { /* default to pcbios dtb as passed by= machine_init */
> >> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 dtb_filename =3D qemu_find_file(= QEMU_FILE_TYPE_BIOS, dtb_filename);
> >> +=C2=A0 =C2=A0 /* default to pcbios dtb as passed by machine_= init */
> >> +=C2=A0 =C2=A0 if (!dtb_arg) {
> >> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 filename =3D qemu_find_file(QEMU= _FILE_TYPE_BIOS, dtb_filename);
> >>=C2=A0 =C2=A0 =C2=A0 }
> >>
> >>=C2=A0 =C2=A0 =C2=A0 boot_info.machine_cpu_reset =3D machine_c= pu_reset;
> >> @@ -203,7 +203,8 @@ void microblaze_load_kernel(MicroBlazeCPU= *cpu, hwaddr ddr_base,
> >>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 boot_info.initrd_start,
> >>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 boot_info.initrd_end,
> >>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 kernel_cmdline,
> >> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 dtb_filename);
> >> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Preference a -dtb argument */
> >> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 dtb_arg ? dtb_arg : filename);
> >>=C2=A0 =C2=A0 =C2=A0 }
> >> -
> >> +=C2=A0 =C2=A0 g_free(filename);
> >>=C2=A0 }
> >>
> >
>
>

--001a1140f794ecc7840512543c8b--