1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-11-16 17:46:40 -05:00

Fix CID 39917 Dereference null return value.

This commit is contained in:
Renaud 2015-03-24 11:59:10 +08:00
parent e34c15741e
commit 5a900d59e6

13
main.c
View File

@ -320,6 +320,12 @@ int main(int argc, char **argv)
/* if there are any files to read, read the first one! */
bp = bfind("main", FALSE, 0);
if( bp == NULL) {
/* "main" buffer has been created during early initialisation */
fputs( "Initialisation failure!\n", stderr) ;
exit( EXIT_FAILURE) ;
}
if (firstfile == FALSE && readfirst_f()) {
swbuffer(firstbp);
zotbuf(bp);
@ -478,8 +484,11 @@ static void edinit(char *bname)
bp = bfind(bname, TRUE, 0); /* First buffer */
blistp = bfind("*List*", TRUE, BFINVS); /* Buffer list buffer */
wp = (struct window *)malloc(sizeof(struct window)); /* First window */
if (bp == NULL || wp == NULL || blistp == NULL)
exit(1);
if (bp == NULL || wp == NULL || blistp == NULL) {
fputs( "First initialisation failed!\n", stderr) ;
exit( EXIT_FAILURE) ;
}
curbp = bp; /* Make this current */
wheadp = wp;
curwp = wp;