Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

A memory leak #252

Open
Open

Description

@worker24h

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);
}
.....
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions