]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
concurrent: check realloc() rc and exit on failure
authorArjun Sreedharan <arjun024@gmail.com>
Wed, 1 Apr 2015 19:06:48 +0000 (00:36 +0530)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 6 Apr 2015 16:12:10 +0000 (12:12 -0400)
Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/tests/concurrent.c

index acabbed4f1da0fec5420cabd549be9233ab9ccfc..f32411afe6cc515b4702b1490bfbff50819c2c20 100644 (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;