* [LTP] [PATCH v2] lib/tst_memutils.c: Fix resource leak
@ 2022-02-11 16:04 Bogdan Lezhepekov
0 siblings, 0 replies; 3+ messages in thread
From: Bogdan Lezhepekov @ 2022-02-11 16:04 UTC (permalink / raw)
To: ltp; +Cc: martin.doucha
File descriptor was not closed properly
before return.
Signed-off-by: Bogdan Lezhepekov <blezhepekov@suse.de>
---
lib/tst_memutils.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/tst_memutils.c b/lib/tst_memutils.c
index 4a4974761..2e6d7d5fd 100644
--- a/lib/tst_memutils.c
+++ b/lib/tst_memutils.c
@@ -122,7 +122,10 @@ static int write_score(const char *path, int score)
return 1;
if (fprintf(f, "%d", score) <= 0)
+ {
+ fclose(f);
return 1;
+ }
if (fclose(f))
return 1;
--
2.35.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [LTP] [PATCH v2] lib/tst_memutils.c: Fix resource leak
@ 2022-02-15 13:31 Bogdan Lezhepekov
2022-02-15 13:33 ` Cyril Hrubis
0 siblings, 1 reply; 3+ messages in thread
From: Bogdan Lezhepekov @ 2022-02-15 13:31 UTC (permalink / raw)
To: ltp
File descriptor was not closed properly
before return.
Signed-off-by: Bogdan Lezhepekov <blezhepekov@suse.de>
---
lib/tst_memutils.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/tst_memutils.c b/lib/tst_memutils.c
index 4a4974761..3741d6e6f 100644
--- a/lib/tst_memutils.c
+++ b/lib/tst_memutils.c
@@ -121,8 +121,10 @@ static int write_score(const char *path, int score)
if (!f)
return 1;
- if (fprintf(f, "%d", score) <= 0)
+ if (fprintf(f, "%d", score) <= 0) {
+ fclose(f);
return 1;
+ }
if (fclose(f))
return 1;
--
2.35.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH v2] lib/tst_memutils.c: Fix resource leak
2022-02-15 13:31 [LTP] [PATCH v2] lib/tst_memutils.c: Fix resource leak Bogdan Lezhepekov
@ 2022-02-15 13:33 ` Cyril Hrubis
0 siblings, 0 replies; 3+ messages in thread
From: Cyril Hrubis @ 2022-02-15 13:33 UTC (permalink / raw)
To: Bogdan Lezhepekov; +Cc: ltp
Hi!
Pushed, thanks.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-15 13:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-15 13:31 [LTP] [PATCH v2] lib/tst_memutils.c: Fix resource leak Bogdan Lezhepekov
2022-02-15 13:33 ` Cyril Hrubis
-- strict thread matches above, loose matches on Subject: below --
2022-02-11 16:04 Bogdan Lezhepekov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox