concurrent: check realloc() rc and exit on failure

Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
Arjun Sreedharan 2015-04-02 00:36:48 +05:30 committed by Stéphane Graber
parent 0cc417b20f
commit ea7e3744e7

View File

@ -182,6 +182,10 @@ int main(int argc, char *argv[]) {
(tok = strtok_r(mode_tok, ",", &saveptr));
i++, mode_tok = NULL) {
modes = realloc(modes, sizeof(*modes) * (i+2));
if (!modes) {
perror("realloc");
exit(EXIT_FAILURE);
}
modes[i] = tok;
}
modes[i] = NULL;