qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 2/2] hw/display/tcx.c: tcx_realizefn: fix memory leak, make FCode loading error fatal and improve error message
@ 2015-05-30 13:54 Michael Tokarev
  2015-06-02  6:20 ` Shannon Zhao
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Tokarev @ 2015-05-30 13:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Michael Tokarev, Shannon Zhao

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/display/tcx.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/hw/display/tcx.c b/hw/display/tcx.c
index a9f9f66..c2b32c3 100644
--- a/hw/display/tcx.c
+++ b/hw/display/tcx.c
@@ -1014,10 +1014,13 @@ static void tcx_realizefn(DeviceState *dev, Error **errp)
     if (fcode_filename) {
         ret = load_image_targphys(fcode_filename, s->prom_addr,
                                   FCODE_MAX_ROM_SIZE);
-        if (ret < 0 || ret > FCODE_MAX_ROM_SIZE) {
-            error_report("tcx: could not load prom '%s'", TCX_ROM_FILE);
-        }
     }
+    if (!fcode_filename || ret < 0 || ret > FCODE_MAX_ROM_SIZE) {
+        error_report("tcx: could not load prom '%s'",
+                     fcode_filename ? fcode_filename : TCX_ROM_FILE);
+        exit(1);
+    }
+    g_free(fcode_filename);
 
     /* 0/DFB8 : 8-bit plane */
     s->vram = vram_base;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] hw/display/tcx.c: tcx_realizefn: fix memory leak, make FCode loading error fatal and improve error message
  2015-05-30 13:54 [Qemu-devel] [PATCH 2/2] hw/display/tcx.c: tcx_realizefn: fix memory leak, make FCode loading error fatal and improve error message Michael Tokarev
@ 2015-06-02  6:20 ` Shannon Zhao
  0 siblings, 0 replies; 2+ messages in thread
From: Shannon Zhao @ 2015-06-02  6:20 UTC (permalink / raw)
  To: Michael Tokarev, qemu-devel; +Cc: qemu-trivial



On 2015/5/30 21:54, Michael Tokarev wrote:
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>

Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>

> ---
>  hw/display/tcx.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/display/tcx.c b/hw/display/tcx.c
> index a9f9f66..c2b32c3 100644
> --- a/hw/display/tcx.c
> +++ b/hw/display/tcx.c
> @@ -1014,10 +1014,13 @@ static void tcx_realizefn(DeviceState *dev, Error **errp)
>      if (fcode_filename) {
>          ret = load_image_targphys(fcode_filename, s->prom_addr,
>                                    FCODE_MAX_ROM_SIZE);
> -        if (ret < 0 || ret > FCODE_MAX_ROM_SIZE) {
> -            error_report("tcx: could not load prom '%s'", TCX_ROM_FILE);
> -        }
>      }
> +    if (!fcode_filename || ret < 0 || ret > FCODE_MAX_ROM_SIZE) {
> +        error_report("tcx: could not load prom '%s'",
> +                     fcode_filename ? fcode_filename : TCX_ROM_FILE);
> +        exit(1);
> +    }
> +    g_free(fcode_filename);
>  
>      /* 0/DFB8 : 8-bit plane */
>      s->vram = vram_base;
> 

-- 
Shannon

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-02  6:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-30 13:54 [Qemu-devel] [PATCH 2/2] hw/display/tcx.c: tcx_realizefn: fix memory leak, make FCode loading error fatal and improve error message Michael Tokarev
2015-06-02  6:20 ` Shannon Zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).