Skip to content
Snippets Groups Projects
Commit 65096959 authored by rtoy's avatar rtoy
Browse files

Exit if malloc fails in make_var. From Carl Shapiro.

parent d24a072d
No related branches found
No related tags found
No related merge requests found
/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/vars.c,v 1.3 2004/07/08 17:49:04 rtoy Exp $ */ /* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/vars.c,v 1.4 2005/08/01 21:53:00 rtoy Exp $ */
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -103,10 +103,16 @@ lispobj obj; ...@@ -103,10 +103,16 @@ lispobj obj;
static struct var *make_var(char *name, boolean perm) static struct var *make_var(char *name, boolean perm)
{ {
struct var *var = (struct var *)malloc(sizeof(struct var)); struct var *var;
char buffer[256]; char buffer[256];
int index; int index;
var = (struct var *)malloc(sizeof(struct var));
if (var == NULL) {
perror("malloc");
exit(1);
}
if (name == NULL) { if (name == NULL) {
sprintf(buffer, "%d", tempcntr++); sprintf(buffer, "%d", tempcntr++);
name = buffer; name = buffer;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment