Commit 3b31b0c9 authored by Neal Norwitz's avatar Neal Norwitz

Handle malloc failure.

Klocwork 281
parent 1a8a49a8
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment