diff options
author | Chad Loder <cloder@cvs.openbsd.org> | 2005-03-08 03:05:08 +0000 |
---|---|---|
committer | Chad Loder <cloder@cvs.openbsd.org> | 2005-03-08 03:05:08 +0000 |
commit | 8a14afb7d5e87c5c1dfc05ae6b32587e7636d7f6 (patch) | |
tree | 5fba0a59a82d5b3e7d6f04340280a30164275175 /usr.bin/asn1_compile/gen.c | |
parent | 841d346ec5723054cac4ec8893b7772c81a283de (diff) |
Always check string allocation for failure. From Bruno Rohee, thanks.
Diffstat (limited to 'usr.bin/asn1_compile/gen.c')
-rw-r--r-- | usr.bin/asn1_compile/gen.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/asn1_compile/gen.c b/usr.bin/asn1_compile/gen.c index 922d9317f08..2843f29be56 100644 --- a/usr.bin/asn1_compile/gen.c +++ b/usr.bin/asn1_compile/gen.c @@ -61,7 +61,7 @@ add_import (const char *module) { struct import *tmp = malloc (sizeof(*tmp)); if(tmp == NULL) - errx(1, "Out of memory"); + err(1, NULL); tmp->module = module; tmp->next = imports; @@ -79,8 +79,13 @@ init_generate (const char *filename, const char *base) { orig_filename = filename; if(base) - asprintf(&headerbase, "%s", base); + if((headerbase = strdup(base)) == NULL) + err(1, NULL); + asprintf(&header, "%s.h", headerbase); + if(header == NULL) + err(1, NULL); + headerfile = fopen (header, "w"); if (headerfile == NULL) err (1, "open %s", header); |