Use new_array() instead of malloc().
authorWayne Davison <wayned@samba.org>
Mon, 16 May 2005 23:36:13 +0000 (23:36 +0000)
committerWayne Davison <wayned@samba.org>
Mon, 16 May 2005 23:36:13 +0000 (23:36 +0000)
link-by-hash.diff

index 6c1e6f3..8461fc7 100644 (file)
@@ -130,7 +130,7 @@ the file's name.
 +              if (this_fnbr > *fnbr)
 +                      *fnbr = this_fnbr;
 +
-+              hashfile = (struct hashfile_struct*)malloc(sizeof(struct hashfile_struct));
++              hashfile = new_array(struct hashfile_struct, 1);
 +              asprintf(&hashfile->name,"%s/%s",hashname,
 +                       di->d_name);
 +              if (do_stat(hashfile->name,&st) == -1) {
@@ -511,7 +511,7 @@ the file's name.
                /* recv file data */
 +#if HAVE_LINK
 +              if (link_by_hash_dir)
-+                      file->u.sum = (char*)malloc(MD4_SUM_LENGTH);
++                      file->u.sum = new_array(char, MD4_SUM_LENGTH);
 +#endif
                recv_ok = receive_data(f_in, fnamecmp, fd1, st.st_size,
 -                                     fname, fd2, file->length);
@@ -560,7 +560,7 @@ the file's name.
  
  #include "byteorder.h"
  #include "lib/mdfour.h"
---- orig/rsync.yo      2005-05-10 16:14:33
+--- orig/rsync.yo      2005-05-10 23:47:12
 +++ rsync.yo   2005-02-13 06:58:47
 @@ -356,6 +356,7 @@ to the detailed description below for a 
       --compare-dest=DIR      also compare received files relative to DIR