catch error from as.*printf

This commit is contained in:
Love Hornquist Astrand
2010-05-30 13:28:09 -07:00
parent 9773655027
commit 351e0d0914
5 changed files with 51 additions and 41 deletions

View File

@@ -1007,7 +1007,8 @@ static void fix_labels1(struct memhead *members, const char *prefix)
if(members == NULL)
return;
ASN1_TAILQ_FOREACH(m, members, members) {
asprintf(&m->label, "%s_%s", prefix, m->gen_name);
if (asprintf(&m->label, "%s_%s", prefix, m->gen_name) < 0)
errx(1, "malloc");
if (m->label == NULL)
errx(1, "malloc");
if(m->type != NULL)
@@ -1024,9 +1025,8 @@ static void fix_labels2(Type *t, const char *prefix)
static void
fix_labels(Symbol *s)
{
char *p;
asprintf(&p, "choice_%s", s->gen_name);
if (p == NULL)
char *p = NULL;
if (asprintf(&p, "choice_%s", s->gen_name) < 0 || p == NULL)
errx(1, "malloc");
fix_labels2(s->type, p);
free(p);