changeset 942:85cf59eafce2

2008-01-24 Brian Masney <masneyb@gftp.org> * lib/config_file.c lib/sshv2.c lib/sslcommon.c lib/rfc2068.c - s/g_malloc/g_malloc0/
author masneyb
date Thu, 24 Jan 2008 23:28:30 +0000
parents 19b6d55e2646
children ca75331d0f82
files ChangeLog lib/config_file.c lib/rfc2068.c lib/sshv2.c lib/sslcommon.c
diffstat 5 files changed, 20 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Jan 24 23:26:45 2008 +0000
+++ b/ChangeLog	Thu Jan 24 23:28:30 2008 +0000
@@ -1,4 +1,7 @@
 2008-01-24 Brian Masney <masneyb@gftp.org>
+	* lib/config_file.c lib/sshv2.c lib/sslcommon.c lib/rfc2068.c -
+	s/g_malloc/g_malloc0/
+	
 	* src/gtk/gftp-gtk.c src/gtk/menu-items.c src/gtk/transfer.c
 	src/gtk/dnd.c src/gtk/gtkui_transfer.c src/gtk/bookmarks.c
 	src/uicommon/gftpui.c - s/g_malloc/g_malloc0/
--- a/lib/config_file.c	Thu Jan 24 23:26:45 2008 +0000
+++ b/lib/config_file.c	Thu Jan 24 23:28:30 2008 +0000
@@ -363,7 +363,7 @@
       else
 	endpos = curpos + strlen (curpos);
 
-      *dest = g_malloc ((gulong) (endpos - curpos + 1));
+      *dest = g_malloc0 ((gulong) (endpos - curpos + 1));
       tempchar = *endpos;
       *endpos = '\0';
       strcpy (*dest, curpos);
@@ -395,8 +395,7 @@
   while (numargs > 1)
     {
       dest = va_arg (argp, char **);
-      *dest = g_malloc (1);
-      **dest = '\0';
+      *dest = g_malloc0 (1);
       numargs--;
     }
   va_end (argp);
@@ -477,7 +476,7 @@
 {
   gftp_file_extensions * tempext;
 
-  tempext = g_malloc (sizeof (*tempext));
+  tempext = g_malloc0 (sizeof (*tempext));
   gftp_config_parse_args (buf, 4, line, &tempext->ext, &tempext->filename,
                           &tempext->ascii_binary, &tempext->view_program);
  
@@ -1121,7 +1120,7 @@
 
   gftp_config_parse_args (str, 3, line, &red, &green, &blue);
 
-  color = g_malloc (sizeof (*color));
+  color = g_malloc0 (sizeof (*color));
   color->red = strtol (red, NULL, 16);
   color->green = strtol (green, NULL, 16);
   color->blue = strtol (blue, NULL, 16);
@@ -1154,7 +1153,7 @@
   if (dest_cv->flags & GFTP_CVARS_FLAGS_DYNMEM && dest_cv->value != NULL)
     g_free (dest_cv->value);
 
-  dest_cv->value = g_malloc (sizeof (gftp_color));
+  dest_cv->value = g_malloc0 (sizeof (gftp_color));
   memcpy (dest_cv->value, cv->value, sizeof (gftp_color));
   dest_cv->flags |= GFTP_CVARS_FLAGS_DYNMEM;
 }
@@ -1483,7 +1482,7 @@
   *new_options_hash = g_hash_table_new (string_hash_function,
                                         string_hash_compare);
 
-  *new_options_vars = g_malloc ((gulong) sizeof (gftp_config_vars) * num_local_options_vars);
+  *new_options_vars = g_malloc0 ((gulong) sizeof (gftp_config_vars) * num_local_options_vars);
   memcpy (*new_options_vars, orig_options,
           sizeof (gftp_config_vars) * num_local_options_vars);
 
--- a/lib/rfc2068.c	Thu Jan 24 23:26:45 2008 +0000
+++ b/lib/rfc2068.c	Thu Jan 24 23:28:30 2008 +0000
@@ -162,7 +162,7 @@
         {
           params->extra_read_buffer_len = params->chunk_size * -1;
           params->chunk_size = 0;
-          params->extra_read_buffer = g_malloc ((gulong) params->extra_read_buffer_len + 1);
+          params->extra_read_buffer = g_malloc0 ((gulong) params->extra_read_buffer_len + 1);
           memcpy (params->extra_read_buffer, params->rbuf->curpos + (params->rbuf->cur_bufsize - params->extra_read_buffer_len), params->extra_read_buffer_len);
           params->extra_read_buffer[params->extra_read_buffer_len] = '\0';
           params->rbuf->cur_bufsize -= params->extra_read_buffer_len;
@@ -800,7 +800,7 @@
           /* The current chunk size is split between multiple packets.
              Save this chunk and read the next */
 
-          params->extra_read_buffer = g_malloc ((gulong) current_size + 1);
+          params->extra_read_buffer = g_malloc0 ((gulong) current_size + 1);
           memcpy (params->extra_read_buffer, stpos, current_size);
           params->extra_read_buffer[current_size] = '\0';
           params->extra_read_buffer_len = current_size;
--- a/lib/sshv2.c	Thu Jan 24 23:26:45 2008 +0000
+++ b/lib/sshv2.c	Thu Jan 24 23:28:30 2008 +0000
@@ -341,7 +341,7 @@
 
   args_len = 1;
   args_cur = 15;
-  args = g_malloc (sizeof (char *) * args_cur);
+  args = g_malloc0 (sizeof (char *) * args_cur);
   args[0] = g_strdup (tempstr);
 
   logstr = g_strdup (args[0]);
@@ -837,7 +837,7 @@
     }
 
   message->command = buf[4];
-  message->buffer = g_malloc (message->length + 1);
+  message->buffer = g_malloc0 (message->length + 1);
 
   message->pos = message->buffer;
   message->end = message->buffer + message->length - 1;
@@ -1032,7 +1032,7 @@
 
   if (return_string)
     {
-      string = g_malloc (len + 1);
+      string = g_malloc0 (len + 1);
       memcpy (string, message->pos, len);
       string[len] = '\0';
     }
@@ -1477,7 +1477,7 @@
 
       if (!request->cached)
         {
-          request->last_dir_entry = g_malloc (params->message.length + 4);
+          request->last_dir_entry = g_malloc0 (params->message.length + 4);
           len = htonl (params->message.length);
           memcpy (request->last_dir_entry, &len, 4);
           request->last_dir_entry[4] = params->message.command;
@@ -1918,7 +1918,7 @@
   if (params->transfer_buffer == NULL)
     {
       params->transfer_buffer_len = params->handle_len + 12;
-      params->transfer_buffer = g_malloc (params->transfer_buffer_len);
+      params->transfer_buffer = g_malloc0 (params->transfer_buffer_len);
       memcpy (params->transfer_buffer, params->handle, params->handle_len);
     }
 
@@ -1987,7 +1987,7 @@
   if (params->transfer_buffer == NULL)
     {
       params->transfer_buffer_len = params->handle_len + size + 12;
-      params->transfer_buffer = g_malloc (params->transfer_buffer_len);
+      params->transfer_buffer = g_malloc0 (params->transfer_buffer_len);
       memcpy (params->transfer_buffer, params->handle, params->handle_len);
     }
 
@@ -2083,7 +2083,7 @@
   memcpy (dparms->handle, sparms->handle, sizeof (*dparms->handle));
   if (sparms->transfer_buffer != NULL)
     {
-      dparms->transfer_buffer = g_malloc (sparms->transfer_buffer_len);
+      dparms->transfer_buffer = g_malloc0 (sparms->transfer_buffer_len);
       memcpy (dparms->transfer_buffer, sparms->transfer_buffer,
               sparms->transfer_buffer_len);
     }
--- a/lib/sslcommon.c	Thu Jan 24 23:26:45 2008 +0000
+++ b/lib/sslcommon.c	Thu Jan 24 23:28:30 2008 +0000
@@ -237,7 +237,7 @@
 { 
   struct CRYPTO_dynlock_value *value;
 
-  value = g_malloc (sizeof (*value));
+  value = g_malloc0 (sizeof (*value));
   value->mutex = g_mutex_new ();
   return (value);
 }
@@ -273,7 +273,7 @@
   return;
 #endif
 
-  gftp_ssl_mutexes = g_malloc (CRYPTO_num_locks( ) * sizeof (*gftp_ssl_mutexes));
+  gftp_ssl_mutexes = g_malloc0 (CRYPTO_num_locks( ) * sizeof (*gftp_ssl_mutexes));
 
   for (i = 0; i < CRYPTO_num_locks ( ); i++)
     gftp_ssl_mutexes[i] = g_mutex_new ();