Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

freeing networkConfig query results in crashes #590

Closed
gdamore opened this issue Sep 22, 2017 · 1 comment
Closed

freeing networkConfig query results in crashes #590

gdamore opened this issue Sep 22, 2017 · 1 comment

Comments

@gdamore
Copy link

gdamore commented Sep 22, 2017

Given the following code, I get all kinds of crashes, and valgrind says that the free is incorrect, reporting numerous use after-free errors. If I comment out the ZT_Node_freeQueryResult, then everything works. The docs in the ZeroTierOne.h header indicate that ZT_Node_networkConfig's return should be freed with freeQueryResult. Something isn't right.

        ZT_VirtualNetworkConfig *vcfg;
	int                      status;
	int                      rv;

	nni_mtx_lock(&zt_lk);
	vcfg = ZT_Node_networkConfig(ztn->zn_znode, nwid);
	if (vcfg == NULL) {
		nni_mtx_unlock(&zt_lk);
		return (NNG_ECLOSED);
	}
	status = vcfg->status;
	ZT_Node_freeQueryResult(ztn->zn_znode, vcfg);
	nni_mtx_unlock(&zt_lk);
@gdamore
Copy link
Author

gdamore commented Sep 22, 2017

Actually, the above code wasn't the failing code, I was instead passing backwards parameters to freeQueryResult. Argh.

@gdamore gdamore closed this as completed Sep 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant