]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[Backport r51256 | neal.norwitz]
authorAndrew M. Kuchling <amk@amk.ca>
Tue, 3 Oct 2006 18:34:29 +0000 (18:34 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Tue, 3 Oct 2006 18:34:29 +0000 (18:34 +0000)
Handle malloc failure.

Klocwork 281

Parser/grammar.c

index c0613dfcfe1b1cfab4eafb8da9654087e16d8ff6..0c8703baec050310289f5e94b2e678dd84cb4a1f 100644 (file)
@@ -195,6 +195,10 @@ translabel(grammar *g, label *lb)
                        else
                                name_len = strlen(src);
                        dest = 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);