From: Ryan Underwood Date: Tue, 26 May 2015 21:56:12 +0000 (-0700) Subject: Merge remote-tracking branch 'upstream/develop' into unmalloc X-Git-Url: https://git.gsnw.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3d74b33f4cfb2c173ab93f881ef5ff30e503e847;p=fping.git Merge remote-tracking branch 'upstream/develop' into unmalloc Conflicts: src/fping.c --- 3d74b33f4cfb2c173ab93f881ef5ff30e503e847 diff --cc src/fping.c index b11a395,73ef004..7c01694 --- a/src/fping.c +++ b/src/fping.c @@@ -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);