chunk mem leak, and undiagnose chunk code
This commit is contained in:
parent
c9190eee44
commit
30a479de68
3 changed files with 18 additions and 17 deletions
|
|
@ -39,10 +39,9 @@
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
* Compile with chunk diagnostics. XXX Should be in Makefile.in ??
|
* Compile with chunk diagnostics. XXX Should be in Makefile.in ??
|
||||||
*/
|
*/
|
||||||
#define CHUNK_DIAG
|
#undef CHUNK_DIAG
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Base number of bits to shift getting the size of a chunk_head.
|
* Base number of bits to shift getting the size of a chunk_head.
|
||||||
|
|
@ -165,7 +164,7 @@ char *_chunk_sprintf (const char *, const char *, int, const char *, ...);
|
||||||
#else /* CHUNK_DIAG */
|
#else /* CHUNK_DIAG */
|
||||||
void *chunk (size_t, const char *);
|
void *chunk (size_t, const char *);
|
||||||
void *rechunk (void *, size_t, const char *);
|
void *rechunk (void *, size_t, const char *);
|
||||||
void *chunkdup (void *, size_t, const char *);
|
void *chunkdup (const void *, size_t, const char *);
|
||||||
char *chunk_strncat (const char *, const char *, size_t, const char *);
|
char *chunk_strncat (const char *, const char *, size_t, const char *);
|
||||||
char *chunk_sprintf (const char *, char *, ...);
|
char *chunk_sprintf (const char *, char *, ...);
|
||||||
#endif /* CHUNK_DIAG */
|
#endif /* CHUNK_DIAG */
|
||||||
|
|
|
||||||
|
|
@ -710,18 +710,13 @@ chunk_check(FILE *fout, const char *name)
|
||||||
chunk_group_t *grp = NULL;
|
chunk_group_t *grp = NULL;
|
||||||
chunk_grpent_t *ent;
|
chunk_grpent_t *ent;
|
||||||
|
|
||||||
|
|
||||||
if (!chunk_initialized)
|
if (!chunk_initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
/* No name given, walk through everything
|
/* No name given, walk through everything
|
||||||
*/
|
*/
|
||||||
if (name == (const char *)NULL) {
|
if (name == (const char *)NULL) {
|
||||||
|
|
||||||
for (idx = 0; idx < CHUNK_HEADS; idx++) {
|
for (idx = 0; idx < CHUNK_HEADS; idx++) {
|
||||||
chunk_head_t *chead = &chunk_heads[idx];
|
chunk_head_t *chead = &chunk_heads[idx];
|
||||||
|
|
||||||
cnk = chead->ch_cnks;
|
cnk = chead->ch_cnks;
|
||||||
if (cnk == (chunk_t *)NULL)
|
if (cnk == (chunk_t *)NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -730,7 +725,7 @@ chunk_check(FILE *fout, const char *name)
|
||||||
|
|
||||||
/* If no file name it's an internal chunk */
|
/* If no file name it's an internal chunk */
|
||||||
if (cnk->c_diag.cd_file)
|
if (cnk->c_diag.cd_file)
|
||||||
fprintf(fout ? fout : stdout,
|
clicon_debug(0,
|
||||||
"%s:%d,\t%zu bytes (%p), group \"%s\"\n",
|
"%s:%d,\t%zu bytes (%p), group \"%s\"\n",
|
||||||
cnk->c_diag.cd_file,
|
cnk->c_diag.cd_file,
|
||||||
cnk->c_diag.cd_line,
|
cnk->c_diag.cd_line,
|
||||||
|
|
@ -786,4 +781,9 @@ chunk_check(FILE *fout, const char *name)
|
||||||
} while (ent != grp->cg_ent);
|
} while (ent != grp->cg_ent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else /* CHUNK_DIAG */
|
||||||
|
void
|
||||||
|
chunk_check(FILE *fout, const char *name)
|
||||||
|
{
|
||||||
|
}
|
||||||
#endif /* CHUNK_DIAG */
|
#endif /* CHUNK_DIAG */
|
||||||
|
|
|
||||||
|
|
@ -707,6 +707,8 @@ get(char *dbname,
|
||||||
goto done;
|
goto done;
|
||||||
/* Assume body is created at end of function */
|
/* Assume body is created at end of function */
|
||||||
}
|
}
|
||||||
|
free(argdec);
|
||||||
|
argdec = NULL;
|
||||||
break;
|
break;
|
||||||
case Y_LIST:
|
case Y_LIST:
|
||||||
/*
|
/*
|
||||||
|
|
@ -1011,7 +1013,6 @@ xmldb_get_local(clicon_handle h,
|
||||||
/* If vectors are specified then filter out everything else,
|
/* If vectors are specified then filter out everything else,
|
||||||
* otherwise return complete tree.
|
* otherwise return complete tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (xvec != NULL)
|
if (xvec != NULL)
|
||||||
for (i=0; i<xlen; i++)
|
for (i=0; i<xlen; i++)
|
||||||
xml_flag_set(xvec[i], XML_FLAG_MARK);
|
xml_flag_set(xvec[i], XML_FLAG_MARK);
|
||||||
|
|
@ -1041,6 +1042,7 @@ xmldb_get_local(clicon_handle h,
|
||||||
free(dbname);
|
free(dbname);
|
||||||
if (xvec)
|
if (xvec)
|
||||||
free(xvec);
|
free(xvec);
|
||||||
|
unchunk_group(__FUNCTION__);
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue