]> git.gsnw.org Git - fping.git/commitdiff
Merge remote-tracking branch 'upstream/develop' into unmalloc
authorRyan Underwood <nemesis@icequake.net>
Tue, 26 May 2015 21:56:12 +0000 (14:56 -0700)
committerRyan C. Underwood <nemesis@icequake.net>
Tue, 26 May 2015 21:56:12 +0000 (14:56 -0700)
Conflicts:
src/fping.c

1  2 
src/fping.c

diff --cc src/fping.c
index b11a3957a96abee59adf81185a45707c4f7c469d,73ef004824cc019aa4025ded28d890d637560983..7c01694f56e8020c9b7fd152e358425ba8bab3f1
@@@ -1403,8 -1404,18 +1407,14 @@@ int send_ping( int s, HOST_ENTRY *h 
      int myseq;
      int ret = 1;
  
-     memset( ping_buffer, 0, ping_pkt_size * sizeof( char ) );
 -    buffer = ( char* )malloc( ( size_t )ping_pkt_size );
 -    if( !buffer )
 -        crash_and_burn( "can't malloc ping packet" );
 -    
+     if (random_data_flag) {
+         for (n = 0; n < ping_pkt_size; ++n) {
 -            buffer[n] = random() & 0xFF;
++            ping_buffer[n] = random() & 0xFF;
+         }
+     } else {
 -        memset( buffer, 0, ping_pkt_size * sizeof( char ) );
++        memset( ping_buffer, 0, ping_pkt_size * sizeof( char ) );
+     }
 -    icp = ( FPING_ICMPHDR* )buffer;
 +    icp = ( FPING_ICMPHDR* )ping_buffer;
  
      gettimeofday( &h->last_send_time, &tz );
      myseq = seqmap_add(h->i, h->num_sent, &h->last_send_time);