summaryrefslogtreecommitdiffstats
path: root/dimension/lexer.l
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-03-12 17:09:39 -0500
committerTavian Barnes <tavianator@gmail.com>2010-03-12 17:09:39 -0500
commit17f12a717ffea58b430affff4951c6527189c990 (patch)
treef2eb880c4843488c24e10557d9ad894caec6cce5 /dimension/lexer.l
parent0b2d17d4e1fc42dddfa70113779d240603979af1 (diff)
downloaddimension-17f12a717ffea58b430affff4951c6527189c990.tar.xz
Check for strdup() failures.
Diffstat (limited to 'dimension/lexer.l')
-rw-r--r--dimension/lexer.l13
1 files changed, 8 insertions, 5 deletions
diff --git a/dimension/lexer.l b/dimension/lexer.l
index 05c6711..5027d71 100644
--- a/dimension/lexer.l
+++ b/dimension/lexer.l
@@ -71,11 +71,14 @@
RETURN(); \
} while (0)
-#define RETURN_VALUE_TOKEN(token_type) \
- do { \
- NEW_TOKEN(token_type); \
- lvalp->value = strdup(yytext); \
- RETURN(); \
+#define RETURN_VALUE_TOKEN(token_type) \
+ do { \
+ NEW_TOKEN(token_type); \
+ lvalp->value = strdup(yytext); \
+ if (!lvalp->value) \
+ dmnsn_error(DMNSN_SEVERITY_HIGH, \
+ "Couldn't allocate space for token value."); \
+ RETURN(); \
} while (0)
#define STRING_TOKEN() \