Sanity checking of malloc added Signed-off-by: Maninder Singh <maninder...@samsung.com> Reviewed-by: Yogesh Narayan Gaur <yn.g...@samsung.com> --- .../conformance/interfaces/shm_unlink/10-1.c | 5 +++++ .../conformance/interfaces/shm_unlink/10-2.c | 5 +++++ 2 files changed, 10 insertions(+)
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/shm_unlink/10-1.c b/testcases/open_posix_testsuite/conformance/interfaces/shm_unlink/10-1.c index bcfa42c..768863c 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/shm_unlink/10-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/shm_unlink/10-1.c @@ -29,6 +29,11 @@ int main(void) name_max = pathconf("/", _PC_NAME_MAX); shm_name = malloc(name_max + 3); + if (!shm_name) { + perror("malloc() failed"); + return PTS_UNRESOLVED; + } + shm_name[0] = '/'; for (i = 1; i < name_max + 2; i++) shm_name[i] = 'a'; diff --git a/testcases/open_posix_testsuite/conformance/interfaces/shm_unlink/10-2.c b/testcases/open_posix_testsuite/conformance/interfaces/shm_unlink/10-2.c index 7d478c7..9402e1b 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/shm_unlink/10-2.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/shm_unlink/10-2.c @@ -39,6 +39,11 @@ int main(void) } shm_name = malloc(path_max + 1); + if (!shm_name) { + perror("malloc() failed"); + return PTS_UNRESOLVED; + } + for (i = 0; i < path_max; i++) shm_name[i] = (i + 1) % COMPONENT_SIZE ? 'a' : '/'; shm_name[path_max] = 0; -- 1.7.9.5 ------------------------------------------------------------------------------ Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list