Re: [PATCH v2] selftests/rtc:Fix a resource leak

2024-07-16 Thread John Hubbard
On 7/10/24 9:00 AM, Shuah Khan wrote: On 7/10/24 01:55, Alexandre Belloni wrote: On 10/07/2024 00:43:09-0700, Zhu Jun wrote: The opened file should be closed before exit, otherwise resource leak will occur that this problem was discovered by code reading The question is still why should it be

Re: [PATCH v2] selftests/rtc:Fix a resource leak

2024-07-10 Thread Shuah Khan
On 7/10/24 01:55, Alexandre Belloni wrote: On 10/07/2024 00:43:09-0700, Zhu Jun wrote: The opened file should be closed before exit, otherwise resource leak will occur that this problem was discovered by code reading The question is still why should it be closed before exit as it will be close

Re: [PATCH v2] selftests/rtc:Fix a resource leak

2024-07-10 Thread Alexandre Belloni
On 10/07/2024 00:43:09-0700, Zhu Jun wrote: > The opened file should be closed before exit, otherwise resource leak > will occur that this problem was discovered by code reading The question is still why should it be closed before exit as it will be closed on exit? > > Signed-off-by: Zhu Jun >

[PATCH v2] selftests/rtc:Fix a resource leak

2024-07-10 Thread Zhu Jun
The opened file should be closed before exit, otherwise resource leak will occur that this problem was discovered by code reading Signed-off-by: Zhu Jun --- >From a good programming practice perspective, especially in more complex >programs, explicitly freeing allocated memory is a good habit!