]> git.meshlink.io Git - catta/blobdiff - announce.c
fix some memory corruption bugs
[catta] / announce.c
index 9229753d9051beb9a78153f0038ddab9740413c3..1671758d2fcab2ed844a919a297d0769434bb243 100644 (file)
@@ -116,13 +116,18 @@ void flx_announce_entry(flxServer *s, flxServerEntry *e) {
 
 static flxRecord *make_goodbye_record(flxRecord *r) {
     gchar *t;
+    flxRecord *g;
     
     g_assert(r);
 
     g_message("Preparing goodbye for record [%s]", t = flx_record_to_string(r));
     g_free(t);
 
-    return flx_record_new(r->key, r->data, r->size, 0);
+    g = flx_record_copy(r);
+    g_assert(g->ref == 1);
+    g->ttl = 0;
+
+    return g;
 }
     
 void flx_goodbye_interface(flxServer *s, flxInterface *i, gboolean goodbye) {