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

A memory leak #252

Open
worker24h opened this issue Dec 30, 2016 · 0 comments
Open

A memory leak #252

worker24h opened this issue Dec 30, 2016 · 0 comments

Comments

@worker24h
Copy link

Hi, michalvasko:
I find a memory leak when i read code. The following code is:
nc_reply* ncds_apply_rpc(ncds_id id, const struct nc_session* session, const nc_rpc* rpc, struct nc_filter* shared_filter)
{
....
if (ds->transapis != NULL
&& (op == NC_OP_COMMIT || op == NC_OP_COPYCONFIG || (op == NC_OP_EDITCONFIG && (nc_rpc_get_testopt(rpc) != NC_EDIT_TESTOPT_TEST))) &&
(nc_rpc_get_target(rpc) == NC_DATASTORE_RUNNING)) {

	old_data = ds->func.getconfig(ds, session, NC_DATASTORE_RUNNING, &e);
	old = read_datastore_data(ds->id, old_data);
	if (old == NULL) {/* cannot get or parse data */
		pthread_mutex_unlock(&ds->lock);
		if (e == NULL) { /* error not set */
			e = nc_err_new(NC_ERR_OP_FAILED);
			nc_err_set(e, NC_ERR_PARAM_MSG, "TransAPI: Failed to get data from RUNNING datastore.");
		}

// not free data. this is bug??
return nc_reply_error(e);
}
free(old_data);
}
.....
}

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