diff options
author | Scott Wood <scottwood@freescale.com> | 2008-01-07 14:27:36 -0600 |
---|---|---|
committer | Jon Loeliger <jdl@freescale.com> | 2008-01-07 14:36:41 -0600 |
commit | 42107f8bba994f718594dd670a937861d40f425d (patch) | |
tree | a0f4721f00f597a7be7d17822dc5ce62515daa8d /srcpos.c | |
parent | 3c3ecaacda4f7ef201d02682382a64674661cae3 (diff) | |
download | dtc-42107f8bba994f718594dd670a937861d40f425d.tar.gz |
Convert malloc() uses to xmalloc().
Signed-off-by: Scott Wood <scottwood@freescale.com>
Diffstat (limited to 'srcpos.c')
-rw-r--r-- | srcpos.c | 12 |
1 files changed, 3 insertions, 9 deletions
@@ -33,9 +33,7 @@ static int dtc_open_one(struct dtc_file *file, char *fullname; if (search) { - fullname = malloc(strlen(search) + strlen(fname) + 2); - if (!fullname) - die("Out of memory\n"); + fullname = xmalloc(strlen(search) + strlen(fname) + 2); strcpy(fullname, search); strcat(fullname, "/"); @@ -63,15 +61,11 @@ struct dtc_file *dtc_open_file(const char *fname, struct dtc_file *file; const char *slash; - file = malloc(sizeof(struct dtc_file)); - if (!file) - die("Out of memory\n"); + file = xmalloc(sizeof(struct dtc_file)); slash = strrchr(fname, '/'); if (slash) { - char *dir = malloc(slash - fname + 1); - if (!dir) - die("Out of memory\n"); + char *dir = xmalloc(slash - fname + 1); memcpy(dir, fname, slash - fname); dir[slash - fname] = 0; |