You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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);
}
.....
}
The text was updated successfully, but these errors were encountered:
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)) {
// not free data. this is bug??
return nc_reply_error(e);
}
free(old_data);
}
.....
}
The text was updated successfully, but these errors were encountered: