Convert malloc() uses to xmalloc().
Signed-off-by: Scott Wood <scottwood@freescale.com>main
parent
3c3ecaacda
commit
42107f8bba
|
@ -273,11 +273,7 @@ int push_input_file(const char *filename)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
incl_file = malloc(sizeof(struct incl_file));
|
incl_file = xmalloc(sizeof(struct incl_file));
|
||||||
if (!incl_file) {
|
|
||||||
yyerror("Can not allocate include file space.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Save current context.
|
* Save current context.
|
||||||
|
|
12
srcpos.c
12
srcpos.c
|
@ -33,9 +33,7 @@ static int dtc_open_one(struct dtc_file *file,
|
||||||
char *fullname;
|
char *fullname;
|
||||||
|
|
||||||
if (search) {
|
if (search) {
|
||||||
fullname = malloc(strlen(search) + strlen(fname) + 2);
|
fullname = xmalloc(strlen(search) + strlen(fname) + 2);
|
||||||
if (!fullname)
|
|
||||||
die("Out of memory\n");
|
|
||||||
|
|
||||||
strcpy(fullname, search);
|
strcpy(fullname, search);
|
||||||
strcat(fullname, "/");
|
strcat(fullname, "/");
|
||||||
|
@ -63,15 +61,11 @@ struct dtc_file *dtc_open_file(const char *fname,
|
||||||
struct dtc_file *file;
|
struct dtc_file *file;
|
||||||
const char *slash;
|
const char *slash;
|
||||||
|
|
||||||
file = malloc(sizeof(struct dtc_file));
|
file = xmalloc(sizeof(struct dtc_file));
|
||||||
if (!file)
|
|
||||||
die("Out of memory\n");
|
|
||||||
|
|
||||||
slash = strrchr(fname, '/');
|
slash = strrchr(fname, '/');
|
||||||
if (slash) {
|
if (slash) {
|
||||||
char *dir = malloc(slash - fname + 1);
|
char *dir = xmalloc(slash - fname + 1);
|
||||||
if (!dir)
|
|
||||||
die("Out of memory\n");
|
|
||||||
|
|
||||||
memcpy(dir, fname, slash - fname);
|
memcpy(dir, fname, slash - fname);
|
||||||
dir[slash - fname] = 0;
|
dir[slash - fname] = 0;
|
||||||
|
|
Loading…
Reference in New Issue