From: Richard Jones Date: Wed, 12 Aug 2009 17:23:17 +0000 (+0100) Subject: Return error if allocations fail. X-Git-Tag: 1.0.67~39 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=27566d8323e4a8af59f5649aeeaef97ebd55cbd0;p=libguestfs.git Return error if allocations fail. --- diff --git a/daemon/command.c b/daemon/command.c index 3261513..4420cba 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);