Issue 9869 - replace malloc and memset with ast_calloc, and other coding guidelines changes

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@67864 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Tilghman Lesher
2007-06-06 21:20:11 +00:00
parent 033a3df22a
commit 9d05ff8ed5
94 changed files with 2530 additions and 2701 deletions

View File

@@ -87,12 +87,12 @@ struct io_context *io_context_create(void)
tmp->current_ioc = -1;
if (!(tmp->fds = ast_calloc(1, (GROW_SHRINK_SIZE / 2) * sizeof(*tmp->fds)))) {
free(tmp);
ast_free(tmp);
tmp = NULL;
} else {
if (!(tmp->ior = ast_calloc(1, (GROW_SHRINK_SIZE / 2) * sizeof(*tmp->ior)))) {
free(tmp->fds);
free(tmp);
ast_free(tmp->fds);
ast_free(tmp);
tmp = NULL;
}
}
@@ -104,11 +104,11 @@ void io_context_destroy(struct io_context *ioc)
{
/* Free associated memory with an I/O context */
if (ioc->fds)
free(ioc->fds);
ast_free(ioc->fds);
if (ioc->ior)
free(ioc->ior);
ast_free(ioc->ior);
free(ioc);
ast_free(ioc);
}
/*! \brief
@@ -250,7 +250,7 @@ int ast_io_remove(struct io_context *ioc, int *_id)
for (x = 0; x < ioc->fdcnt; x++) {
if (ioc->ior[x].id == _id) {
/* Free the int immediately and set to NULL so we know it's unused now */
free(ioc->ior[x].id);
ast_free(ioc->ior[x].id);
ioc->ior[x].id = NULL;
ioc->fds[x].events = 0;
ioc->fds[x].revents = 0;