appFirewall icon indicating copy to clipboard operation
appFirewall copied to clipboard

Pointer being freed was not allocated

Open CaramelHeaven opened this issue 5 years ago • 2 comments

Hello Sir. When I'm tried to build a release version via Product -> Archive I'm encountered with that crash. What do u think about it? Am I the only one who had this?

The bug is here (sn_pktap.num_pds)

void stop_sniffer() {
	// called by SIGTERM handler,
	// hard stop on pcap devices might cause segfault later, but
	// that's ok as (i) stopping anyway, (ii) won't return from this
	// signal handler. leaving open pcap devices is really bad as we'll
	// run out of them over time (a sort of mem leak)
	are_sniffing = 0;
	for (int i=0; i<sn_pktap.num_pds; i++) {
		if (sn_pktap.sn[i].pd) pcap_close(sn_pktap.sn[i].pd);
		sn_pktap.sn[i].pd = NULL;
	}
	sn_pktap.num_pds = 0;
}
  • OS: MacOs Catalina
  • Version 10.15.7

CaramelHeaven avatar Nov 08 '20 19:11 CaramelHeaven

Hmm. The loop won't execute if sn_pktap.num_pds is 0 so your if statement doesn't change anything. The error is probably that sn_pktap.sn[i].pd has already been freed. Do you have the actual error plus stacktrace? Can you reproduce the error, and if so how? Thanks.

doug-leith avatar Nov 08 '20 19:11 doug-leith

Thanks for reply. Indeed. I missed that.

Nope, it's strange that I can not see anymore the app crash and it logs in console app.

My steps to reproduce error. Go to the last commit -> in xcode try to press on Product then Archive Developer ID -> Export -> Manually... -> Set profiles to none -> Export. Open (I guess it doesn't matter but anyway..)

The app is trying to show auth window (for privileged tool) and at that moment just closed automatically.

You can try to build release version on ur machine and check it out I assume. If all goes well it will be a strange issue.

The interesting thing is if you try to build app via xcode (in this way everything is works) and then open the release app it will be work perfectly 'cause I assume the privileged tool is created (located in /LocalDaemons and so forth) and the released app found it. Curiously.

CaramelHeaven avatar Nov 09 '20 17:11 CaramelHeaven