vss: Fix harmless memory leaks at exit.
[paraslash.git] / send_common.c
index 24b14ab8ed50b90c956fc6578199f8a4da3f2c4e..ea494d9a7b23f5ee87186917d11e883631ec9cbc 100644 (file)
@@ -154,6 +154,25 @@ void init_sender_status(struct sender_status *ss,
        ss->default_deny = default_deny;
 }
 
+/**
+ * Deallocate all resources allocated in \ref init_sender_status().
+ *
+ * \param ss The structure whose components should be freed.
+ *
+ * This frees the dynamically allocated parts of the structure which was
+ * initialized by an earlier call to \ref init_sender_status(). It does *not*
+ * call free(ss), though.
+ */
+void free_sender_status(const struct sender_status *ss)
+{
+       int i;
+
+       free(ss->listen_fds);
+       FOR_EACH_LISTEN_FD(i, ss)
+               free(ss->listen_addresses[i]);
+       free(ss->listen_addresses);
+}
+
 /**
  * Return a string containing the current status of a sender.
  *