Index: res/res_jabber.c =================================================================== --- res/res_jabber.c (revision 66997) +++ res/res_jabber.c (working copy) @@ -241,7 +241,7 @@ /* Specified version not found. Let's add it to this node in our capabilities list */ if(!res) { - res = (struct aji_version *)malloc(sizeof(struct aji_version)); + res = ast_malloc(sizeof(struct aji_version)); if(!res) { ast_log(LOG_ERROR, "Out of memory!\n"); return NULL; @@ -258,12 +258,12 @@ } /* Specified node not found. Let's add it our capabilities list */ if(!list) { - list = (struct aji_capabilities *)malloc(sizeof(struct aji_capabilities)); + list = ast_malloc(sizeof(struct aji_capabilities)); if(!list) { ast_log(LOG_ERROR, "Out of memory!\n"); return NULL; } - res = (struct aji_version *)malloc(sizeof(struct aji_version)); + res = ast_malloc(sizeof(struct aji_version)); if(!res) { ast_log(LOG_ERROR, "Out of memory!\n"); return NULL; @@ -1226,8 +1226,7 @@ } if (!found && status != 6) { - found = (struct aji_resource *) malloc(sizeof(struct aji_resource)); - memset(found, 0, sizeof(struct aji_resource)); + found = ast_calloc(1, sizeof(struct aji_resource)); if (!found) { ast_log(LOG_ERROR, "Out of memory!\n"); @@ -1732,12 +1731,11 @@ }); if (!flag) { - buddy = (struct aji_buddy *) malloc(sizeof(struct aji_buddy)); + buddy = ast_calloc(1, sizeof(struct aji_buddy)); if (!buddy) { ast_log(LOG_WARNING, "Out of memory\n"); return 0; } - memset(buddy, 0, sizeof(struct aji_buddy)); ASTOBJ_INIT(buddy); ASTOBJ_WRLOCK(buddy); ast_copy_string(buddy->name, iks_find_attrib(x, "jid"), sizeof(buddy->name)); @@ -2060,12 +2058,11 @@ client = ASTOBJ_CONTAINER_FIND(&clients,label); if (!client) { flag = 1; - client = (struct aji_client *) malloc(sizeof(struct aji_client)); + client = ast_calloc(1, sizeof(struct aji_client)); if (!client) { ast_log(LOG_ERROR, "Out of memory!\n"); return 0; } - memset(client, 0, sizeof(struct aji_client)); ASTOBJ_INIT(client); ASTOBJ_WRLOCK(client); ASTOBJ_CONTAINER_INIT(&client->buddies); @@ -2198,12 +2195,11 @@ buddy = ASTOBJ_CONTAINER_FIND(&client->buddies,label); if (!buddy) { - buddy = malloc(sizeof(struct aji_buddy)); + buddy = ast_calloc(1, sizeof(struct aji_buddy)); if(!buddy) { ast_log(LOG_WARNING, "Out of memory\n"); return 0; } - memset(buddy, 0, sizeof(struct aji_buddy)); ASTOBJ_INIT(buddy); } ASTOBJ_WRLOCK(buddy); @@ -2248,12 +2244,11 @@ buddy = ASTOBJ_CONTAINER_FIND(&client->buddies,label); if (!buddy) { flag = 1; - buddy = malloc(sizeof(struct aji_buddy)); + buddy = ast_calloc(1, sizeof(struct aji_buddy)); if(!buddy) { ast_log(LOG_WARNING, "Out of memory\n"); return 0; } - memset(buddy, 0, sizeof(struct aji_buddy)); ASTOBJ_INIT(buddy); } ASTOBJ_WRLOCK(buddy);