bug-inetutils
[Top][All Lists]
Advanced

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

[bug-inetutils] syntax-check: sc_cast_of_x_alloc_return_value


From: Simon Josefsson
Subject: [bug-inetutils] syntax-check: sc_cast_of_x_alloc_return_value
Date: Fri, 13 Nov 2009 18:44:37 +0100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux)

To fix this:

hostname/hostname.c:241:  aliases = (char *) xmalloc (sizeof (char) * size);
hostname/hostname.c:297:  addresses = (char *) xmalloc (sizeof (char) * size);
ping/ping_common.c:67:  data_buffer = (u_char *) xmalloc (data_length);
rsh/rsh.c:365:    term = (char *) xmalloc (strlen (args) + 4);
maint.mk: don't cast x*alloc return value
make: *** [sc_cast_of_x_alloc_return_value] Error 1

/Simon

>From e1cc9b2ef35660642ea5a89ff8dfaeee31d2b612 Mon Sep 17 00:00:00 2001
From: Simon Josefsson <address@hidden>
Date: Fri, 13 Nov 2009 18:43:49 +0100
Subject: [PATCH] Fix syntax-check sc_cast_of_x_alloc_return_value.

---
 ChangeLog           |    7 +++++++
 hostname/hostname.c |    4 ++--
 ping/ping_common.c  |    2 +-
 rsh/rsh.c           |    2 +-
 4 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9a034c6..7b78e9a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2009-11-13  Simon Josefsson  <address@hidden>
 
+       * hostname/hostname.c (get_aliases, get_ip_addresses): Fix
+       syntax-check sc_cast_of_x_alloc_return_value.
+       * ping/ping_common.c (init_data_buffer): Likewise.
+       * rsh/rsh.c (main): Likewise.
+
+2009-11-13  Simon Josefsson  <address@hidden>
+
        * rshd/rshd.c (doit): Fix syntax-check
        sc_cast_of_alloca_return_value.
        * ftpd/ftpd.c (send_file_list): Likewise.
diff --git a/hostname/hostname.c b/hostname/hostname.c
index 9f399f3..875bc11 100644
--- a/hostname/hostname.c
+++ b/hostname/hostname.c
@@ -238,7 +238,7 @@ get_aliases (const char *const host_name)
   unsigned int size = 256;
   struct hostent *ht;
 
-  aliases = (char *) xmalloc (sizeof (char) * size);
+  aliases = xmalloc (sizeof (char) * size);
   aliases[0] = '\0';
 
   ht = gethostbyname (host_name);
@@ -294,7 +294,7 @@ get_ip_addresses (const char *const host_name)
   unsigned int size = 256;
   struct hostent *ht;
 
-  addresses = (char *) xmalloc (sizeof (char) * size);
+  addresses = xmalloc (sizeof (char) * size);
   addresses[0] = '\0';
 
   ht = gethostbyname (host_name);
diff --git a/ping/ping_common.c b/ping/ping_common.c
index 7021c4e..4206d52 100644
--- a/ping/ping_common.c
+++ b/ping/ping_common.c
@@ -64,7 +64,7 @@ init_data_buffer (u_char * pat, int len)
   if (data_length == 0)
     return;
 
-  data_buffer = (u_char *) xmalloc (data_length);
+  data_buffer = xmalloc (data_length);
 
   if (pat)
     {
diff --git a/rsh/rsh.c b/rsh/rsh.c
index cc36cc1..5ee5c61 100644
--- a/rsh/rsh.c
+++ b/rsh/rsh.c
@@ -362,7 +362,7 @@ try_connect:
          int i;
          char *term;
 
-         term = (char *) xmalloc (strlen (args) + 4);
+         term = xmalloc (strlen (args) + 4);
          strcpy (term, "-x ");
          strcat (term, args);
 
-- 
1.6.5.2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]