Commit ea7e3744 by Arjun Sreedharan Committed by Stéphane Graber

concurrent: check realloc() rc and exit on failure

parent 0cc417b2
...@@ -182,6 +182,10 @@ int main(int argc, char *argv[]) { ...@@ -182,6 +182,10 @@ int main(int argc, char *argv[]) {
(tok = strtok_r(mode_tok, ",", &saveptr)); (tok = strtok_r(mode_tok, ",", &saveptr));
i++, mode_tok = NULL) { i++, mode_tok = NULL) {
modes = realloc(modes, sizeof(*modes) * (i+2)); modes = realloc(modes, sizeof(*modes) * (i+2));
if (!modes) {
perror("realloc");
exit(EXIT_FAILURE);
}
modes[i] = tok; modes[i] = tok;
} }
modes[i] = NULL; modes[i] = NULL;
......
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