[Libguestfs] [PATCH] error log: keep more calloc and its error messages match

Chen Hanxiao chenhanxiao at cn.fujitsu.com
Thu Jun 18 08:35:56 UTC 2015


Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
---
 cat/cat.c             | 4 ++--
 cat/ls.c              | 4 ++--
 daemon/md.c           | 2 +-
 daemon/stat.c         | 2 +-
 daemon/xattr.c        | 2 +-
 df/main.c             | 4 ++--
 edit/edit.c           | 4 ++--
 fish/fish.c           | 6 +++---
 fish/options.c        | 4 ++--
 inspector/inspector.c | 4 ++--
 rescue/rescue.c       | 6 +++---
 11 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/cat/cat.c b/cat/cat.c
index 5a438ce..82f0055 100644
--- a/cat/cat.c
+++ b/cat/cat.c
@@ -191,7 +191,7 @@ main (int argc, char *argv[])
           access (argv[optind], F_OK) == 0) { /* simulate -a option */
         drv = calloc (1, sizeof (struct drv));
         if (!drv) {
-          perror ("malloc");
+          perror ("calloc");
           exit (EXIT_FAILURE);
         }
         drv->type = drv_a;
@@ -205,7 +205,7 @@ main (int argc, char *argv[])
       } else {                  /* simulate -d option */
         drv = calloc (1, sizeof (struct drv));
         if (!drv) {
-          perror ("malloc");
+          perror ("calloc");
           exit (EXIT_FAILURE);
         }
         drv->type = drv_d;
diff --git a/cat/ls.c b/cat/ls.c
index 9161fb6..3bced54 100644
--- a/cat/ls.c
+++ b/cat/ls.c
@@ -293,7 +293,7 @@ main (int argc, char *argv[])
           access (argv[optind], F_OK) == 0) { /* simulate -a option */
         drv = calloc (1, sizeof (struct drv));
         if (!drv) {
-          perror ("malloc");
+          perror ("calloc");
           exit (EXIT_FAILURE);
         }
         drv->type = drv_a;
@@ -307,7 +307,7 @@ main (int argc, char *argv[])
       } else {                  /* simulate -d option */
         drv = calloc (1, sizeof (struct drv));
         if (!drv) {
-          perror ("malloc");
+          perror ("calloc");
           exit (EXIT_FAILURE);
         }
         drv->type = drv_d;
diff --git a/daemon/md.c b/daemon/md.c
index 941d05d..08a17e3 100644
--- a/daemon/md.c
+++ b/daemon/md.c
@@ -394,7 +394,7 @@ parse_md_stat_line (char *line)
   ret->guestfs_int_mdstat_list_val =
     calloc (spaces+1, sizeof (struct guestfs_int_mdstat));
   if (ret->guestfs_int_mdstat_list_val == NULL) {
-    reply_with_perror ("malloc");
+    reply_with_perror ("calloc");
     free (ret);
     return NULL;
   }
diff --git a/daemon/stat.c b/daemon/stat.c
index a784914..73f1922 100644
--- a/daemon/stat.c
+++ b/daemon/stat.c
@@ -138,7 +138,7 @@ do_internal_lstatnslist (const char *path, char *const *names)
   ret->guestfs_int_statns_list_val =
     calloc (nr_names, sizeof (guestfs_int_statns));
   if (ret->guestfs_int_statns_list_val == NULL) {
-    reply_with_perror ("malloc");
+    reply_with_perror ("calloc");
     free (ret);
     return NULL;
   }
diff --git a/daemon/xattr.c b/daemon/xattr.c
index c32e1a7..8aa28d1 100644
--- a/daemon/xattr.c
+++ b/daemon/xattr.c
@@ -120,7 +120,7 @@ getxattrs (const char *path,
 
   r = calloc (1, sizeof (*r));
   if (r == NULL) {
-    reply_with_perror ("malloc");
+    reply_with_perror ("calloc");
     goto error;
   }
 
diff --git a/df/main.c b/df/main.c
index a43c11f..517bd45 100644
--- a/df/main.c
+++ b/df/main.c
@@ -217,7 +217,7 @@ main (int argc, char *argv[])
           access (argv[optind], F_OK) == 0) { /* simulate -a option */
         drv = calloc (1, sizeof (struct drv));
         if (!drv) {
-          perror ("malloc");
+          perror ("calloc");
           exit (EXIT_FAILURE);
         }
         drv->type = drv_a;
@@ -231,7 +231,7 @@ main (int argc, char *argv[])
       } else {                  /* simulate -d option */
         drv = calloc (1, sizeof (struct drv));
         if (!drv) {
-          perror ("malloc");
+          perror ("calloc");
           exit (EXIT_FAILURE);
         }
         drv->type = drv_d;
diff --git a/edit/edit.c b/edit/edit.c
index 775170b..b874492 100644
--- a/edit/edit.c
+++ b/edit/edit.c
@@ -226,7 +226,7 @@ main (int argc, char *argv[])
           access (argv[optind], F_OK) == 0) { /* simulate -a option */
         drv = calloc (1, sizeof (struct drv));
         if (!drv) {
-          perror ("malloc");
+          perror ("calloc");
           exit (EXIT_FAILURE);
         }
         drv->type = drv_a;
@@ -240,7 +240,7 @@ main (int argc, char *argv[])
       } else {                  /* simulate -d option */
         drv = calloc (1, sizeof (struct drv));
         if (!drv) {
-          perror ("malloc");
+          perror ("calloc");
           exit (EXIT_FAILURE);
         }
         drv->type = drv_d;
diff --git a/fish/fish.c b/fish/fish.c
index 714a13c..c37368e 100644
--- a/fish/fish.c
+++ b/fish/fish.c
@@ -361,7 +361,7 @@ main (int argc, char *argv[])
       }
       drv = calloc (1, sizeof (struct drv));
       if (!drv) {
-        perror ("malloc");
+        perror ("calloc");
         exit (EXIT_FAILURE);
       }
       drv->type = drv_N;
@@ -449,7 +449,7 @@ main (int argc, char *argv[])
           access (argv[optind], F_OK) == 0) { /* simulate -a option */
         drv = calloc (1, sizeof (struct drv));
         if (!drv) {
-          perror ("malloc");
+          perror ("calloc");
           exit (EXIT_FAILURE);
         }
         drv->type = drv_a;
@@ -463,7 +463,7 @@ main (int argc, char *argv[])
       } else {                  /* simulate -d option */
         drv = calloc (1, sizeof (struct drv));
         if (!drv) {
-          perror ("malloc");
+          perror ("calloc");
           exit (EXIT_FAILURE);
         }
         drv->type = drv_d;
diff --git a/fish/options.c b/fish/options.c
index b1be711..da5015d 100644
--- a/fish/options.c
+++ b/fish/options.c
@@ -38,7 +38,7 @@ option_a (const char *arg, const char *format, struct drv **drvsp)
 
   drv = calloc (1, sizeof (struct drv));
   if (!drv) {
-    perror ("malloc");
+    perror ("calloc");
     exit (EXIT_FAILURE);
   }
 
@@ -84,7 +84,7 @@ option_d (const char *arg, struct drv **drvsp)
 
   drv = calloc (1, sizeof (struct drv));
   if (!drv) {
-    perror ("malloc");
+    perror ("calloc");
     exit (EXIT_FAILURE);
   }
 
diff --git a/inspector/inspector.c b/inspector/inspector.c
index 412384a..70b7cd3 100644
--- a/inspector/inspector.c
+++ b/inspector/inspector.c
@@ -196,7 +196,7 @@ main (int argc, char *argv[])
           access (argv[optind], F_OK) == 0) { /* simulate -a option */
         drv = calloc (1, sizeof (struct drv));
         if (!drv) {
-          perror ("malloc");
+          perror ("calloc");
           exit (EXIT_FAILURE);
         }
         drv->type = drv_a;
@@ -210,7 +210,7 @@ main (int argc, char *argv[])
       } else {                  /* simulate -d option */
         drv = calloc (1, sizeof (struct drv));
         if (!drv) {
-          perror ("malloc");
+          perror ("calloc");
           exit (EXIT_FAILURE);
         }
         drv->type = drv_d;
diff --git a/rescue/rescue.c b/rescue/rescue.c
index 8c0b507..9e0a516 100644
--- a/rescue/rescue.c
+++ b/rescue/rescue.c
@@ -253,7 +253,7 @@ main (int argc, char *argv[])
           access (argv[optind], F_OK) == 0) { /* simulate -a option */
         drv = calloc (1, sizeof (struct drv));
         if (!drv) {
-          perror ("malloc");
+          perror ("calloc");
           exit (EXIT_FAILURE);
         }
         drv->type = drv_a;
@@ -267,7 +267,7 @@ main (int argc, char *argv[])
       } else {                  /* simulate -d option */
         drv = calloc (1, sizeof (struct drv));
         if (!drv) {
-          perror ("malloc");
+          perror ("calloc");
           exit (EXIT_FAILURE);
         }
         drv->type = drv_d;
@@ -530,7 +530,7 @@ add_scratch_disk (struct drv **drvs)
   /* Add the scratch disk to the drives list. */
   drv = calloc (1, sizeof (struct drv));
   if (!drv) {
-    perror ("malloc");
+    perror ("calloc");
     exit (EXIT_FAILURE);
   }
   drv->type = drv_scratch;
-- 
2.1.0




More information about the Libguestfs mailing list