diff --git a/lib/asn1/lex.l b/lib/asn1/lex.l index cb9dd4d42..4397e1bbb 100644 --- a/lib/asn1/lex.l +++ b/lib/asn1/lex.l @@ -11,10 +11,6 @@ #include "symbol.h" #include "parse.h" -#ifndef HAVE_STRDUP -char *strdup(char *); -#endif - void error_message(char *, ...); static unsigned lineno = 1; diff --git a/lib/asn1/parse.y b/lib/asn1/parse.y index 19cb3cd94..b4b468c10 100644 --- a/lib/asn1/parse.y +++ b/lib/asn1/parse.y @@ -11,14 +11,12 @@ #include "lex.h" #include "asn1_locl.h" +RCSID("$Id$"); + static Type *new_type (Typetype t); void yyerror (char *); int yylex(); -#ifndef HAVE_STRDUP -char *strdup(char *); -#endif - static void append (Member *l, Member *r); %} @@ -170,6 +168,10 @@ static Type * new_type (Typetype tt) { Type *t = malloc(sizeof(*t)); + if (t == NULL) { + error_message ("out of memory in malloc(%u)", sizeof(*t)); + exit (1); + } t->type = tt; t->application = 0; t->members = NULL;