[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



---
 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]