rt-tests/SOURCES/rt-tests-deadline_test-Add-NULL-check-before-freeing.patch

31 lines
821 B
Diff
Raw Normal View History

2019-05-07 13:49:33 +00:00
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