Replaced stream manipulation with EnsureCapacity.
authorArmin Novak <armin.novak@thincast.com>
Mon, 29 Feb 2016 11:54:31 +0000 (12:54 +0100)
committerArmin Novak <armin.novak@thincast.com>
Mon, 29 Feb 2016 11:54:31 +0000 (12:54 +0100)
server/Sample/sfreerdp.c

index 96b6c9c..9095f4a 100644 (file)
@@ -441,17 +441,13 @@ BOOL tf_peer_dump_rfx(freerdp_peer* client)
 
        while (pcap_has_next_record(pcap_rfx))
        {
-               BYTE* tmp = NULL;
                if (!pcap_get_next_record_header(pcap_rfx, &record))
                        break;
 
-               tmp = realloc(Stream_Buffer(s), record.length);
-               if (!tmp)
+               if (!Stream_EnsureCapacity(s, record.length))
                        break;
 
-               Stream_SetBuffer(s, tmp);
                record.data = Stream_Buffer(s);
-               Stream_SetCapacity(s, record.length);
 
                pcap_get_next_record_content(pcap_rfx, &record);
                Stream_SetPointer(s, Stream_Buffer(s) + Stream_Capacity(s));