Skip to content

Commit

Permalink
Merge pull request #279 from btriller/mem-cleanup
Browse files Browse the repository at this point in the history
Cleanup allocated memory
  • Loading branch information
kYroL01 authored Jun 9, 2024
2 parents 9e9cb6c + 3aae016 commit bacb032
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/captagent.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ static void print_all_devices()
pcap_if_t *all_devs, *d = NULL;
char err_buff[PCAP_ERRBUF_SIZE];

printf("List of available devices on your system:\n");
if (pcap_findalldevs(&all_devs, err_buff) == -1) {
if (pcap_findalldevs(&all_devs, err_buff) == PCAP_ERROR) {
fprintf(stderr, "Error in pcap_findalldevs: %s\n", err_buff);
usage(0);
exit(-1);
}

printf("List of available devices on your system:\n");
for (d = all_devs; d; d = d->next) {
if ((strncmp(d->name, "any", 3) != 0) && (strncmp(d->name, "lo", 2) != 0)) {
printf("device %d = %s", ++i, d->name);
Expand All @@ -154,6 +154,7 @@ static void print_all_devices()
printf("\t\t No description available for this device\n");
}
}
pcap_freealldevs(all_devs);
}


Expand Down

0 comments on commit bacb032

Please sign in to comment.