comparison mcabber/mcabber/caps.c @ 2220:79e12dacbccd

Fix a 1-byte memory leak in caps_generate() The caps value is correctly stolen and reinserted but the previous hash key should be freed. This is a special key "" of 1 byte.
author Mikael Berthe <mikael@lilotux.net>
date Fri, 06 Nov 2015 13:43:15 +0100
parents fa516ef22145
children 3f9988ec21e0
comparison
equal deleted inserted replaced
2219:3958793d0d03 2220:79e12dacbccd
278 GList *features, *langs; 278 GList *features, *langs;
279 GChecksum *sha1; 279 GChecksum *sha1;
280 guint8 digest[20]; 280 guint8 digest[20];
281 gsize digest_size = 20; 281 gsize digest_size = 20;
282 gchar *hash, *old_hash = NULL; 282 gchar *hash, *old_hash = NULL;
283 caps *old_caps; 283 caps *old_caps, *c;
284 caps *c = g_hash_table_lookup(caps_cache, ""); 284 gpointer key;
285
286 if (!g_hash_table_lookup_extended(caps_cache, "", &key, &c))
287 return NULL;
285 288
286 g_hash_table_steal(caps_cache, ""); 289 g_hash_table_steal(caps_cache, "");
290 g_free(key);
291
287 sha1 = g_checksum_new(G_CHECKSUM_SHA1); 292 sha1 = g_checksum_new(G_CHECKSUM_SHA1);
288 293
289 langs = g_hash_table_get_keys(c->identities); 294 langs = g_hash_table_get_keys(c->identities);
290 langs = g_list_sort(langs, _strcmp_sort); 295 langs = g_list_sort(langs, _strcmp_sort);
291 { 296 {