Coding style cleanups; add a null check

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2011-05-19 16:59:53 -05:00
parent ba467779bb
commit f2c4e7e552
2 changed files with 10 additions and 5 deletions

View File

@ -1265,8 +1265,9 @@ static void cl_to_log(int argc, char* argv[])
size += strlen(argv[i]) + 1;
}
char *cl_text = malloc(size);
if(!cl_text)
if(!cl_text) {
return;
}
char *p = cl_text;
for(i = 0; i<argc-1; i++) {
strcpy(p, argv[i]);

View File

@ -78,6 +78,10 @@ static int search_path(char **filename, struct stat *bufptr)
}
fullname = malloc(plen + flen + 2);
if(!fullname) {
free(envpath);
return(-1);
}
sprintf(fullname, "%s/%s", path, *filename);
if(lstat(fullname, bufptr) == 0) {