rxcallback_t userfunc;
keylen = aimutil_get16(command->data+10);
- key = malloc(keylen);
+ key = malloc(keylen+1);
memcpy(key, command->data+12, keylen);
key[keylen] = '\0';
if (!newsnac)
return 0;
- snac = calloc(1, sizeof(struct aim_snac_t));
- if (!snac)
+ if (!(snac = calloc(1, sizeof(struct aim_snac_t))))
return 0;
memcpy(snac, newsnac, sizeof(struct aim_snac_t));
snac->issuetime = time(&snac->issuetime);
index = snac->id % FAIM_SNAC_HASH_SIZE;
faim_mutex_lock(&sess->snac_hash_locks[index]);
- if (!sess->snac_hash[index])
- sess->snac_hash[index] = snac;
- else {
- snac->next = sess->snac_hash[index];
- sess->snac_hash[index] = snac;
- }
+ snac->next = sess->snac_hash[index];
+ sess->snac_hash[index] = snac;
faim_mutex_unlock(&sess->snac_hash_locks[index]);
return(snac->id);