gftp r950 - in trunk: . lib



Author: masneyb
Date: Thu Jan 24 23:28:30 2008
New Revision: 950
URL: http://svn.gnome.org/viewvc/gftp?rev=950&view=rev

Log:
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/



Modified:
   trunk/ChangeLog
   trunk/lib/config_file.c
   trunk/lib/rfc2068.c
   trunk/lib/sshv2.c
   trunk/lib/sslcommon.c

Modified: trunk/lib/config_file.c
==============================================================================
--- trunk/lib/config_file.c	(original)
+++ trunk/lib/config_file.c	Thu Jan 24 23:28:30 2008
@@ -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);
 

Modified: trunk/lib/rfc2068.c
==============================================================================
--- trunk/lib/rfc2068.c	(original)
+++ trunk/lib/rfc2068.c	Thu Jan 24 23:28:30 2008
@@ -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;

Modified: trunk/lib/sshv2.c
==============================================================================
--- trunk/lib/sshv2.c	(original)
+++ trunk/lib/sshv2.c	Thu Jan 24 23:28:30 2008
@@ -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);
     }

Modified: trunk/lib/sslcommon.c
==============================================================================
--- trunk/lib/sslcommon.c	(original)
+++ trunk/lib/sslcommon.c	Thu Jan 24 23:28:30 2008
@@ -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 ();



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