summaryrefslogtreecommitdiffstats
path: root/daemon/command.c
diff options
context:
space:
mode:
authorRichard Jones <rjones@trick.home.annexia.org>2009-08-12 18:23:17 +0100
committerRichard Jones <rjones@trick.home.annexia.org>2009-08-12 18:23:17 +0100
commit27566d8323e4a8af59f5649aeeaef97ebd55cbd0 (patch)
treee177059f36c5a2e3510288c8540da77f8d93af00 /daemon/command.c
parenta9b0a6d54fe5fa6564f657650d4608240c71ea3a (diff)
downloadlibguestfs-27566d8323e4a8af59f5649aeeaef97ebd55cbd0.tar.gz
libguestfs-27566d8323e4a8af59f5649aeeaef97ebd55cbd0.tar.xz
libguestfs-27566d8323e4a8af59f5649aeeaef97ebd55cbd0.zip
Return error if allocations fail.
Diffstat (limited to 'daemon/command.c')
-rw-r--r--daemon/command.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/daemon/command.c b/daemon/command.c
index 32615137..4420cba8 100644
--- a/daemon/command.c
+++ b/daemon/command.c
@@ -61,6 +61,18 @@ do_command (char **argv)
sysroot_selinux = sysroot_path ("/selinux");
sysroot_sys = sysroot_path ("/sys");
+ if (sysroot_dev == NULL || sysroot_dev_pts == NULL ||
+ sysroot_proc == NULL || sysroot_selinux == NULL ||
+ sysroot_sys == NULL) {
+ reply_with_perror ("malloc");
+ free (sysroot_dev);
+ free (sysroot_dev_pts);
+ free (sysroot_proc);
+ free (sysroot_selinux);
+ free (sysroot_sys);
+ return NULL;
+ }
+
r = command (NULL, NULL, "mount", "--bind", "/dev", sysroot_dev, NULL);
dev_ok = r != -1;
r = command (NULL, NULL, "mount", "--bind", "/dev/pts", sysroot_dev_pts, NULL);