nacm external mem leak
This commit is contained in:
parent
67da95c468
commit
7fb452f96e
3 changed files with 44 additions and 2 deletions
|
|
@ -111,6 +111,8 @@ backend_terminate(clicon_handle h)
|
|||
yspec_free(yspec);
|
||||
if ((yspec = clicon_config_yang(h)) != NULL)
|
||||
yspec_free(yspec);
|
||||
if ((yspec = clicon_nacm_ext_yang(h)) != NULL)
|
||||
yspec_free(yspec);
|
||||
if ((nsctx = clicon_nsctx_global_get(h)) != NULL)
|
||||
cvec_free(nsctx);
|
||||
if ((x = clicon_nacm_ext(h)) != NULL)
|
||||
|
|
@ -212,12 +214,13 @@ nacm_load_external(clicon_handle h)
|
|||
clicon_err(OE_XML, 0, "No xml tree in %s", filename);
|
||||
goto done;
|
||||
}
|
||||
if (clicon_nacm_ext_yang_set(h, yspec) < 0)
|
||||
goto done;
|
||||
if (clicon_nacm_ext_set(h, xt) < 0)
|
||||
goto done;
|
||||
|
||||
retval = 0;
|
||||
done:
|
||||
// XXX if (yspec) /* The clixon yang-spec is not used after this */
|
||||
// XXX yspec_free(yspec);
|
||||
if (f)
|
||||
fclose(f);
|
||||
return retval;
|
||||
|
|
|
|||
|
|
@ -58,6 +58,9 @@ int clicon_dbspec_yang_set(clicon_handle h, yang_stmt *ys);
|
|||
yang_stmt * clicon_config_yang(clicon_handle h);
|
||||
int clicon_config_yang_set(clicon_handle h, yang_stmt *ys);
|
||||
|
||||
yang_stmt * clicon_nacm_ext_yang(clicon_handle h);
|
||||
int clicon_nacm_ext_yang_set(clicon_handle h, yang_stmt *ys);
|
||||
|
||||
cvec *clicon_nsctx_global_get(clicon_handle h);
|
||||
int clicon_nsctx_global_set(clicon_handle h, cvec *nsctx);
|
||||
|
||||
|
|
|
|||
|
|
@ -146,6 +146,42 @@ clicon_config_yang_set(clicon_handle h,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*! Get YANG specification for external NACM (separate from application yangs)
|
||||
* @param[in] h Clicon handle
|
||||
* @retval yspec Yang spec
|
||||
* @see clicon_nacm_ext for external NACM XML
|
||||
*/
|
||||
yang_stmt *
|
||||
clicon_nacm_ext_yang(clicon_handle h)
|
||||
{
|
||||
clicon_hash_t *cdat = clicon_data(h);
|
||||
size_t len;
|
||||
void *p;
|
||||
|
||||
if ((p = clicon_hash_value(cdat, "nacm_ext_yang", &len)) != NULL)
|
||||
return *(yang_stmt **)p;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*! Set yang specification for external NACM
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] yspec Yang spec (malloced pointer)
|
||||
* @see clicon_nacm_ext_set for external NACM XML
|
||||
*/
|
||||
int
|
||||
clicon_nacm_ext_yang_set(clicon_handle h,
|
||||
yang_stmt *ys)
|
||||
{
|
||||
clicon_hash_t *cdat = clicon_data(h);
|
||||
|
||||
/* It is the pointer to ys that should be copied by hash,
|
||||
so we send a ptr to the ptr to indicate what to copy.
|
||||
*/
|
||||
if (clicon_hash_add(cdat, "nacm_ext_yang", &ys, sizeof(ys)) == NULL)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*! Get Global "canonical" namespace context
|
||||
* Canonical: use prefix and namespace specified in the yang modules.
|
||||
* @param[in] h Clicon handle
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue