[PACKET_IO]add gtest case

This commit is contained in:
liuwentan
2022-08-25 15:32:33 +08:00
parent cb93ac4da0
commit df25dd5826
9 changed files with 326 additions and 70 deletions

View File

@@ -302,11 +302,13 @@ ssize_t pio_pcap_file_device_close(struct packet_io_device *pdev)
}
if (pdev->entity.pcap_file_dev_ctx != nullptr) {
if (pdev->entity.pcap_file_dev_ctx->entity.file != nullptr) {
if (!pdev->entity.pcap_file_dev_ctx->is_dir &&
pdev->entity.pcap_file_dev_ctx->entity.file != nullptr) {
cleanup_pcap_plain_file_info(pdev->entity.pcap_file_dev_ctx->entity.file);
}
if (pdev->entity.pcap_file_dev_ctx->entity.dir != nullptr) {
if (pdev->entity.pcap_file_dev_ctx->is_dir &&
pdev->entity.pcap_file_dev_ctx->entity.dir != nullptr) {
cleanup_pcap_directory_info(pdev->entity.pcap_file_dev_ctx->entity.dir);
}
@@ -315,9 +317,9 @@ ssize_t pio_pcap_file_device_close(struct packet_io_device *pdev)
release_pio_packet_queue(&pdev->entity.pcap_file_dev_ctx->pkt_queues[i]);
}
}
}
FREE(pdev->entity.pcap_file_dev_ctx);
FREE(pdev->entity.pcap_file_dev_ctx);
}
return 0;
}