[lxc-devel] [PATCH 1/2] Exit if allocation fails
Michael Santos
michael.santos at gmail.com
Wed Mar 16 14:04:13 UTC 2011
Signed-off-by: Michael Santos <michael.santos at gmail.com>
---
src/lxc/lxc_monitor.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/lxc/lxc_monitor.c b/src/lxc/lxc_monitor.c
index 314d4a5..1da0906 100644
--- a/src/lxc/lxc_monitor.c
+++ b/src/lxc/lxc_monitor.c
@@ -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)) {
--
1.7.0.4
More information about the lxc-devel
mailing list