Re: [PATCH-for-5.2] hw/rx/rx-gdbsim: Fix memory leak

2020-10-30 Thread Philippe Mathieu-Daudé
On 10/29/20 8:57 PM, Richard Henderson wrote: > On 10/28/20 12:22 PM, Philippe Mathieu-Daudé wrote: >> +g_autofree void *dtb; >> >> dtb = load_device_tree(dtb_filename, &dtb_size); > > With g_autofree, we must initialize the variable on declaration. Often this > is > w

Re: [PATCH-for-5.2] hw/rx/rx-gdbsim: Fix memory leak

2020-10-29 Thread Richard Henderson
On 10/28/20 12:22 PM, Philippe Mathieu-Daudé wrote: > +g_autofree void *dtb; > > dtb = load_device_tree(dtb_filename, &dtb_size); With g_autofree, we must initialize the variable on declaration. Often this is with NULL, but in this case, just merge these two lines. Wit

[PATCH-for-5.2] hw/rx/rx-gdbsim: Fix memory leak

2020-10-28 Thread Philippe Mathieu-Daudé
As load_device_tree() returns allocated memory, we need to free it. Cc: Yoshinori Sato Fixes: bda19d7bb56 ("hw/rx: Add RX GDB simulator") Reported-by: Coverity (CID 1432307: RESOURCE_LEAK) Signed-off-by: Philippe Mathieu-Daudé --- Peter mentioned this issue almost 2 months ago: https://www.mail-