Commit b4b8206b authored by Ben Boeckel's avatar Ben Boeckel

vtkPLY: handle realloc errors properly

Change-Id: Ie2cf9e3d5848a22120899a3f867b45808f0f2e78
parent 9a78aa1a
......@@ -1816,7 +1816,14 @@ char **vtkPLY::get_words(FILE *fp, int *nwords, char **orig_line)
/* save pointer to beginning of word */
if (num_words >= max_words) {
max_words += 10;
char** oldwords = words;
words = (char **) realloc (words, sizeof (char *) * max_words);
if (!words) {
*nwords = 0;
*orig_line = NULL;
free(oldwords);
return NULL;
}
}
words[num_words++] = ptr;
......
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