summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-08-13 18:13:36 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-08-13 18:13:36 (GMT)
commit9ac8953568009342d8509abc2ec248d9359d7914 (patch)
tree0ce52798aa942a9820ee70a2af1fc73a00cad746 /Parser
parentccc56c7c96bfdc5776a472a89da6e0b4ae865104 (diff)
downloadcpython-9ac8953568009342d8509abc2ec248d9359d7914.zip
cpython-9ac8953568009342d8509abc2ec248d9359d7914.tar.gz
cpython-9ac8953568009342d8509abc2ec248d9359d7914.tar.bz2
Handle malloc failure.
Klocwork 281
Diffstat (limited to 'Parser')
-rw-r--r--Parser/grammar.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Parser/grammar.c b/Parser/grammar.c
index b0dafe7..9e7c49a 100644
--- a/Parser/grammar.c
+++ b/Parser/grammar.c
@@ -199,6 +199,10 @@ translabel(grammar *g, label *lb)
else
name_len = strlen(src);
dest = (char *)malloc(name_len + 1);
+ if (!dest) {
+ printf("Can't alloc dest '%s'\n", src);
+ return;
+ }
strncpy(dest, src, name_len);
dest[name_len] = '\0';
free(lb->lb_str);