[Libguestfs] [PATCH 05/13] Coverity: Check return value of malloc.

Richard W.M. Jones rjones at redhat.com
Thu Jun 9 10:17:04 UTC 2011


---
 daemon/glob.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/daemon/glob.c b/daemon/glob.c
index e94e4aa..f2815ec 100644
--- a/daemon/glob.c
+++ b/daemon/glob.c
@@ -40,6 +40,10 @@ do_glob_expand (const char *pattern)
     char **rv;
 
     rv = malloc (sizeof (char *) * 1);
+    if (rv == NULL) {
+      reply_with_perror ("malloc");
+      return NULL;
+    }
     rv[0] = NULL;
     return rv;			/* Caller frees. */
   }
-- 
1.7.5.1




More information about the Libguestfs mailing list