1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-06-17 00:05:23 +00: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! */ /* if there are any files to read, read the first one! */
bp = bfind("main", FALSE, 0); 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()) { if (firstfile == FALSE && readfirst_f()) {
swbuffer(firstbp); swbuffer(firstbp);
zotbuf(bp); zotbuf(bp);
@ -478,8 +484,11 @@ static void edinit(char *bname)
bp = bfind(bname, TRUE, 0); /* First buffer */ bp = bfind(bname, TRUE, 0); /* First buffer */
blistp = bfind("*List*", TRUE, BFINVS); /* Buffer list buffer */ blistp = bfind("*List*", TRUE, BFINVS); /* Buffer list buffer */
wp = (struct window *)malloc(sizeof(struct window)); /* First window */ wp = (struct window *)malloc(sizeof(struct window)); /* First window */
if (bp == NULL || wp == NULL || blistp == NULL) if (bp == NULL || wp == NULL || blistp == NULL) {
exit(1); fputs( "First initialisation failed!\n", stderr) ;
exit( EXIT_FAILURE) ;
}
curbp = bp; /* Make this current */ curbp = bp; /* Make this current */
wheadp = wp; wheadp = wp;
curwp = wp; curwp = wp;