summaryrefslogtreecommitdiff
path: root/libpurple/protocols/oscar/snac.c
diff options
context:
space:
mode:
Diffstat (limited to 'libpurple/protocols/oscar/snac.c')
-rw-r--r--libpurple/protocols/oscar/snac.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/libpurple/protocols/oscar/snac.c b/libpurple/protocols/oscar/snac.c
index 4988037f3e..451dfc6647 100644
--- a/libpurple/protocols/oscar/snac.c
+++ b/libpurple/protocols/oscar/snac.c
@@ -56,11 +56,9 @@ aim_snacid_t aim_cachesnac(OscarData *od, const guint16 family, const guint16 ty
snac.type = type;
snac.flags = flags;
- if (datalen) {
- if (!(snac.data = g_malloc(datalen)))
- return 0; /* er... */
- memcpy(snac.data, data, datalen);
- } else
+ if (datalen)
+ snac.data = g_memdup(data, datalen);
+ else
snac.data = NULL;
return aim_newsnac(od, &snac);
@@ -78,9 +76,7 @@ aim_snacid_t aim_newsnac(OscarData *od, aim_snac_t *newsnac)
if (!newsnac)
return 0;
- if (!(snac = g_malloc(sizeof(aim_snac_t))))
- return 0;
- memcpy(snac, newsnac, sizeof(aim_snac_t));
+ snac = g_memdup(newsnac, sizeof(aim_snac_t));
snac->issuetime = time(NULL);
index = snac->id % FAIM_SNAC_HASH_SIZE;
@@ -155,12 +151,12 @@ void aim_cleansnacs(OscarData *od, int maxage)
return;
}
-int aim_putsnac(ByteStream *bs, guint16 family, guint16 subtype, guint16 flags, aim_snacid_t snacid)
+int aim_putsnac(ByteStream *bs, guint16 family, guint16 subtype, aim_snacid_t snacid)
{
byte_stream_put16(bs, family);
byte_stream_put16(bs, subtype);
- byte_stream_put16(bs, flags);
+ byte_stream_put16(bs, 0x0000);
byte_stream_put32(bs, snacid);
return 10;