From: pengzhao Date: Tue, 18 Mar 2003 05:22:39 +0000 (+0000) Subject: adding error handling in runas.c in case the malloc() fails X-Git-Tag: v1_7_110~2^11~158 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=663a06aef989c85318fc0edd3dfd7463ee6552ac;p=fs%2Flustre-release.git adding error handling in runas.c in case the malloc() fails --- diff --git a/lustre/tests/runas.c b/lustre/tests/runas.c index 348ddb9..8731699 100644 --- a/lustre/tests/runas.c +++ b/lustre/tests/runas.c @@ -80,6 +80,11 @@ main(int argc, char**argv) // assemble the command my_argv = (char**)malloc(sizeof(char*)*(argc+1-optind)); + if(my_argv == NULL) { + fprintf(stderr, "Error in allocating memory. (%s)\n", strerror(errno)); + exit(-1); + } + for(i=optind; i< argc; i++) { my_argv[i-optind] = argv[i]; // printf("%s\n",my_argv[i-optind]);