* elf2dmp: Fix memory leak on main() error paths
@ 2020-08-26 10:15 AlexChen
2020-09-04 1:04 ` AlexChen
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: AlexChen @ 2020-08-26 10:15 UTC (permalink / raw)
To: Viktor Prutyanov; +Cc: zhengchuan, qemu-devel, zhang.zhanghailiang
From: AlexChen <alex.chen@huawei.com>
The 'kdgb' is allocating memory in get_kdbg(), but it is not freed
in both fill_header() and fill_context() failed branches, fix it.
Signed-off-by: AlexChen <alex.chen@huawei.com>
---
contrib/elf2dmp/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c
index 9a2dbc2902..ac746e49e0 100644
--- a/contrib/elf2dmp/main.c
+++ b/contrib/elf2dmp/main.c
@@ -568,12 +568,12 @@ int main(int argc, char *argv[])
if (fill_header(&header, &ps, &vs, KdDebuggerDataBlock, kdbg,
KdVersionBlock, qemu_elf.state_nr)) {
err = 1;
- goto out_pdb;
+ goto out_kdbg;
}
if (fill_context(kdbg, &vs, &qemu_elf)) {
err = 1;
- goto out_pdb;
+ goto out_kdbg;
}
if (write_dump(&ps, &header, argv[2])) {
--
2.19.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: elf2dmp: Fix memory leak on main() error paths
2020-08-26 10:15 elf2dmp: Fix memory leak on main() error paths AlexChen
@ 2020-09-04 1:04 ` AlexChen
2020-09-07 1:24 ` Li Qiang
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: AlexChen @ 2020-09-04 1:04 UTC (permalink / raw)
To: Viktor Prutyanov; +Cc: zhengchuan, qemu-devel, zhang.zhanghailiang
Kindly ping.
On 2020/8/26 18:15, AlexChen wrote:
> From: AlexChen <alex.chen@huawei.com>
>
> The 'kdgb' is allocating memory in get_kdbg(), but it is not freed
> in both fill_header() and fill_context() failed branches, fix it.
>
> Signed-off-by: AlexChen <alex.chen@huawei.com>
> ---
> contrib/elf2dmp/main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c
> index 9a2dbc2902..ac746e49e0 100644
> --- a/contrib/elf2dmp/main.c
> +++ b/contrib/elf2dmp/main.c
> @@ -568,12 +568,12 @@ int main(int argc, char *argv[])
> if (fill_header(&header, &ps, &vs, KdDebuggerDataBlock, kdbg,
> KdVersionBlock, qemu_elf.state_nr)) {
> err = 1;
> - goto out_pdb;
> + goto out_kdbg;
> }
>
> if (fill_context(kdbg, &vs, &qemu_elf)) {
> err = 1;
> - goto out_pdb;
> + goto out_kdbg;
> }
>
> if (write_dump(&ps, &header, argv[2])) {
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: elf2dmp: Fix memory leak on main() error paths
2020-08-26 10:15 elf2dmp: Fix memory leak on main() error paths AlexChen
2020-09-04 1:04 ` AlexChen
@ 2020-09-07 1:24 ` Li Qiang
2020-09-10 20:33 ` Viktor Prutyanov
2020-09-11 4:18 ` Thomas Huth
3 siblings, 0 replies; 6+ messages in thread
From: Li Qiang @ 2020-09-07 1:24 UTC (permalink / raw)
To: AlexChen; +Cc: zhengchuan, Qemu Developers, Viktor Prutyanov, zhanghailiang
AlexChen <alex.chen@huawei.com> 于2020年8月26日周三 下午6:16写道:
>
> From: AlexChen <alex.chen@huawei.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
>
> The 'kdgb' is allocating memory in get_kdbg(), but it is not freed
> in both fill_header() and fill_context() failed branches, fix it.
>
> Signed-off-by: AlexChen <alex.chen@huawei.com>
> ---
> contrib/elf2dmp/main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c
> index 9a2dbc2902..ac746e49e0 100644
> --- a/contrib/elf2dmp/main.c
> +++ b/contrib/elf2dmp/main.c
> @@ -568,12 +568,12 @@ int main(int argc, char *argv[])
> if (fill_header(&header, &ps, &vs, KdDebuggerDataBlock, kdbg,
> KdVersionBlock, qemu_elf.state_nr)) {
> err = 1;
> - goto out_pdb;
> + goto out_kdbg;
> }
>
> if (fill_context(kdbg, &vs, &qemu_elf)) {
> err = 1;
> - goto out_pdb;
> + goto out_kdbg;
> }
>
> if (write_dump(&ps, &header, argv[2])) {
> --
> 2.19.1
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: elf2dmp: Fix memory leak on main() error paths
2020-08-26 10:15 elf2dmp: Fix memory leak on main() error paths AlexChen
2020-09-04 1:04 ` AlexChen
2020-09-07 1:24 ` Li Qiang
@ 2020-09-10 20:33 ` Viktor Prutyanov
2020-09-11 4:18 ` Thomas Huth
3 siblings, 0 replies; 6+ messages in thread
From: Viktor Prutyanov @ 2020-09-10 20:33 UTC (permalink / raw)
To: AlexChen; +Cc: zhengchuan, Paolo Bonzini, qemu-devel, zhang.zhanghailiang
On Wed, 26 Aug 2020 18:15:53 +0800
AlexChen <alex.chen@huawei.com> wrote:
> From: AlexChen <alex.chen@huawei.com>
>
> The 'kdgb' is allocating memory in get_kdbg(), but it is not freed
> in both fill_header() and fill_context() failed branches, fix it.
>
> Signed-off-by: AlexChen <alex.chen@huawei.com>
> ---
> contrib/elf2dmp/main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c
> index 9a2dbc2902..ac746e49e0 100644
> --- a/contrib/elf2dmp/main.c
> +++ b/contrib/elf2dmp/main.c
> @@ -568,12 +568,12 @@ int main(int argc, char *argv[])
> if (fill_header(&header, &ps, &vs, KdDebuggerDataBlock, kdbg,
> KdVersionBlock, qemu_elf.state_nr)) {
> err = 1;
> - goto out_pdb;
> + goto out_kdbg;
> }
>
> if (fill_context(kdbg, &vs, &qemu_elf)) {
> err = 1;
> - goto out_pdb;
> + goto out_kdbg;
> }
>
> if (write_dump(&ps, &header, argv[2])) {
Reviewed-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu>
--
Viktor Prutyanov
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: elf2dmp: Fix memory leak on main() error paths
2020-08-26 10:15 elf2dmp: Fix memory leak on main() error paths AlexChen
` (2 preceding siblings ...)
2020-09-10 20:33 ` Viktor Prutyanov
@ 2020-09-11 4:18 ` Thomas Huth
2020-09-11 7:01 ` Laurent Vivier
3 siblings, 1 reply; 6+ messages in thread
From: Thomas Huth @ 2020-09-11 4:18 UTC (permalink / raw)
To: AlexChen, Viktor Prutyanov
Cc: zhengchuan, QEMU Trivial, Paolo Bonzini, qemu-devel, zhang.zhanghailiang
On 26/08/2020 12.15, AlexChen wrote:
> From: AlexChen <alex.chen@huawei.com>
>
> The 'kdgb' is allocating memory in get_kdbg(), but it is not freed
> in both fill_header() and fill_context() failed branches, fix it.
>
> Signed-off-by: AlexChen <alex.chen@huawei.com>
> ---
> contrib/elf2dmp/main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c
> index 9a2dbc2902..ac746e49e0 100644
> --- a/contrib/elf2dmp/main.c
> +++ b/contrib/elf2dmp/main.c
> @@ -568,12 +568,12 @@ int main(int argc, char *argv[])
> if (fill_header(&header, &ps, &vs, KdDebuggerDataBlock, kdbg,
> KdVersionBlock, qemu_elf.state_nr)) {
> err = 1;
> - goto out_pdb;
> + goto out_kdbg;
> }
>
> if (fill_context(kdbg, &vs, &qemu_elf)) {
> err = 1;
> - goto out_pdb;
> + goto out_kdbg;
> }
>
> if (write_dump(&ps, &header, argv[2])) {
>
I think this could go via qemu-trivial (now on CC:).
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: elf2dmp: Fix memory leak on main() error paths
2020-09-11 4:18 ` Thomas Huth
@ 2020-09-11 7:01 ` Laurent Vivier
0 siblings, 0 replies; 6+ messages in thread
From: Laurent Vivier @ 2020-09-11 7:01 UTC (permalink / raw)
To: Thomas Huth, AlexChen, Viktor Prutyanov
Cc: zhengchuan, QEMU Trivial, zhang.zhanghailiang, qemu-devel, Paolo Bonzini
Le 11/09/2020 à 06:18, Thomas Huth a écrit :
> On 26/08/2020 12.15, AlexChen wrote:
>> From: AlexChen <alex.chen@huawei.com>
>>
>> The 'kdgb' is allocating memory in get_kdbg(), but it is not freed
>> in both fill_header() and fill_context() failed branches, fix it.
>>
>> Signed-off-by: AlexChen <alex.chen@huawei.com>
>> ---
>> contrib/elf2dmp/main.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c
>> index 9a2dbc2902..ac746e49e0 100644
>> --- a/contrib/elf2dmp/main.c
>> +++ b/contrib/elf2dmp/main.c
>> @@ -568,12 +568,12 @@ int main(int argc, char *argv[])
>> if (fill_header(&header, &ps, &vs, KdDebuggerDataBlock, kdbg,
>> KdVersionBlock, qemu_elf.state_nr)) {
>> err = 1;
>> - goto out_pdb;
>> + goto out_kdbg;
>> }
>>
>> if (fill_context(kdbg, &vs, &qemu_elf)) {
>> err = 1;
>> - goto out_pdb;
>> + goto out_kdbg;
>> }
>>
>> if (write_dump(&ps, &header, argv[2])) {
>>
>
> I think this could go via qemu-trivial (now on CC:).
>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
>
>
Applied to my trivial-patches branch.
Thanks,
Laurent
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-09-11 7:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-26 10:15 elf2dmp: Fix memory leak on main() error paths AlexChen
2020-09-04 1:04 ` AlexChen
2020-09-07 1:24 ` Li Qiang
2020-09-10 20:33 ` Viktor Prutyanov
2020-09-11 4:18 ` Thomas Huth
2020-09-11 7:01 ` Laurent Vivier
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.