rt-tests/SOURCES/rt-tests-deadline_test-Add-NULL-check-before-freeing.patch
2021-09-10 04:02:41 +00:00

31 lines
821 B
Diff

From ed58e7ad038f11a8e5f194fb9314ebc791e21b99 Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@redhat.com>
Date: Thu, 15 Nov 2018 13:00:06 +0100
Subject: [PATCH] rt-tests: deadline_test: Add NULL check before freeing
setcpu_buf
setcpu_buf doesn't always call malloc, so NULL check it before freeing
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/sched_deadline/deadline_test.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/sched_deadline/deadline_test.c b/src/sched_deadline/deadline_test.c
index 2a63c5f91639..b213c206559c 100644
--- a/src/sched_deadline/deadline_test.c
+++ b/src/sched_deadline/deadline_test.c
@@ -2092,6 +2092,8 @@ int main (int argc, char **argv)
printf("\n");
}
- free(setcpu_buf);
+ if (!setcpu_buf)
+ free(setcpu_buf);
+
return 0;
}
--
2.14.5