pthread_t t;
pthread_attr_t attr;
- sc = malloc(sizeof(struct statechange) + strlen(dev) + 1);
+ sc = ast_calloc(1, sizeof(*sc) + strlen(dev) + 1);
if (sc) {
sc->state = state;
strcpy(sc->dev, dev);
/* Add a new member */
- cur = malloc(sizeof(struct member));
+ cur = ast_calloc(1, sizeof(*cur));
if (cur) {
- memset(cur, 0, sizeof(struct member));
cur->penalty = penalty;
cur->paused = paused;
ast_copy_string(cur->interface, interface, sizeof(cur->interface));
{
struct ast_call_queue *q;
- q = malloc(sizeof(*q));
+ q = ast_calloc(1, sizeof(*q));
if (q) {
- memset(q, 0, sizeof(*q));
ast_mutex_init(&q->lock);
ast_copy_string(q->name, queuename, sizeof(q->name));
}
if (in->cid.cid_ani) {
if (o->chan->cid.cid_ani)
free(o->chan->cid.cid_ani);
- o->chan->cid.cid_ani = malloc(strlen(in->cid.cid_ani) + 1);
+ o->chan->cid.cid_ani = ast_calloc(1, strlen(in->cid.cid_ani) + 1);
if (o->chan->cid.cid_ani)
strncpy(o->chan->cid.cid_ani, in->cid.cid_ani, strlen(in->cid.cid_ani) + 1);
else
announce = announceoverride;
while(cur) {
- tmp = malloc(sizeof(*tmp));
+ tmp = ast_calloc(1, sizeof(*tmp));
if (!tmp) {
ast_mutex_unlock(&qe->parent->lock);
if (use_weight)
ast_log(LOG_WARNING, "Out of memory\n");
goto out;
}
- memset(tmp, 0, sizeof(*tmp));
tmp->stillgoing = -1;
if (option_debug) {
if (url)
}
case 7:
if (state < 100) { /* 0-99 */
- char *num = malloc(3);
+ char *num = ast_malloc(3);
if (num) {
sprintf(num, "%d", state);
}