Fix a memory leak bug for umr tool.
Hi:
The function umr_pm4_decode_ring_is_halted call umr_read_ring_data
to get ringdata, umr_read_ring_data will alloc memory to store ring
data and return the memory pointer to umr_pm4_decode_ring_is_halted, So
the memory should be free in umr_pm4_decode_ring_is_halted.
Thanks.
From 0d4ddc058c433c1887e4c819bc713f1d842fd7c1 Mon Sep 17 00:00:00 2001
From: Erdong zhang <[email protected]>
Date: Fri, 14 Aug 2020 09:43:11 +0800
Subject: [PATCH] fix a memory leak bug in function
umr_pm4_decode_ring_is_halted
The function umr_pm4_decode_ring_is_halted call umr_read_ring_data
to get ringdata, umr_read_ring_data will alloc memory to store ring data and return the memory pointer to umr_pm4_decode_ring_is_halted, So the memory should be free in umr_pm4_decode_ring_is_halted.
--- src/lib/umr_read_pm4_stream.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
src/lib/umr_read_pm4_stream.c +5 -1
@@ -337,10 +337,14 @@ int umr_pm4_decode_ring_is_halted(struct umr_asic *asic, char *ringname) ringsize /=4 ; ringdata[0 ] %= ringsize; ringdata[1 ] %= ringsize; -if (ringdata[0 ] == ringdata[1 ]) +if (ringdata[0 ] == ringdata[1 ]){ +free (ringdata);return 0 ; + }usleep (5 ); } + +free (ringdata);return 1 ; }
Signature · 1 line
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sorry I missed this. I've applied it (with whitespace fixes) and pushed it out to main yesterday.
Cheers,
Tom
Quoted 8 lines · 张二东
Hi:
The functionumr_pm4_decode_ring_is_haltedcallumr_read_ring_datato get ringdata,
umr_read_ring_datawill alloc memory to store ringdata and return the memory pointer to
umr_pm4_decode_ring_is_halted, So the memory should be free inumr_pm4_decode_ring_is_halted.
Quoted 9 lines
Thanks.
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx