]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Exit if allocation fails
authorMichael Santos <michael.santos@gmail.com>
Wed, 16 Mar 2011 14:04:13 +0000 (10:04 -0400)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Wed, 16 Mar 2011 14:14:36 +0000 (15:14 +0100)
Signed-off-by: Michael Santos <michael.santos@gmail.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/lxc_monitor.c

index 314d4a5ee3314163129893b601e147544b4d2d64..1da090617e761a3b9e92a175afcde2c761e08781 100644 (file)
@@ -69,6 +69,10 @@ int main(int argc, char *argv[])
                return -1;
 
        regexp = malloc(strlen(my_args.name) + 3);
+       if (!regexp) {
+               ERROR("failed to allocate memory");
+               return -1;
+       }
        sprintf(regexp, "^%s$", my_args.name);
 
        if (regcomp(&preg, regexp, REG_NOSUB|REG_EXTENDED)) {