Changeset 1935565
- Timestamp:
- 11/29/12 10:26:27 (8 years ago)
- Branches:
- 4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
- Children:
- f240823
- Parents:
- 17dc71c
- Location:
- lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_helper.c
r91ea76c r1935565 216 216 } 217 217 218 /* This is the first packet, so just fire away. */219 /* TODO: finalise packet */220 221 /* XXX: Could we do this more efficiently? */222 223 /* We do a lot of freeing and creating of packet buffers with this224 * method, but at least it works unlike what was here previously */225 //if (packet->buf_control == TRACE_CTRL_PACKET) {226 // free(packet->buffer);227 //}228 229 218 /* The packet that we had read earlier is now ready to be returned 230 219 * to the user - switch all the pointers etc. over */ … … 236 225 packet->buffer = trace->event.packet->buffer; 237 226 packet->buf_control = trace->event.packet->buf_control; 238 239 //trace->event.packet->buffer = NULL;240 //trace->event.packet->buf_control = TRACE_CTRL_EXTERNAL;241 242 //trace_destroy_packet(trace->event.packet);243 //trace->event.packet = NULL;244 227 245 228 event.type = TRACE_EVENT_PACKET; -
lib/trace.c
re90d5a8 r1935565 592 592 if (libtrace->uridata) 593 593 free(libtrace->uridata); 594 if (libtrace->event.packet) 595 trace_destroy_packet(libtrace->event.packet); 594 if (libtrace->event.packet) { 595 /* Don't use trace_destroy_packet here - there is almost 596 * certainly going to be another libtrace_packet_t that is 597 * pointing to the buffer for this packet, so we don't want 598 * to free it. Rather, it will get freed when the user calls 599 * trace_destroy_packet on the libtrace_packet_t that they 600 * own. 601 * 602 * All we need to do then is free our packet structure itself. 603 */ 604 free(libtrace->event.packet); 605 } 596 606 free(libtrace); 597 607 } … … 664 674 */ 665 675 DLLEXPORT void trace_destroy_packet(libtrace_packet_t *packet) { 666 if (packet->buf_control == TRACE_CTRL_PACKET ) {676 if (packet->buf_control == TRACE_CTRL_PACKET && packet->buffer) { 667 677 free(packet->buffer); 668 678 }
Note: See TracChangeset
for help on using the changeset viewer.