afs: Free status items on exit.
authorAndre Noll <maan@tuebingen.mpg.de>
Wed, 3 Jan 2018 00:01:42 +0000 (01:01 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Tue, 13 Mar 2018 02:28:57 +0000 (03:28 +0100)
The server process frees the memory allocated for the status items
on exit but the afs process does not. To avoid the leak we have to
make free_status_items() public.

afs.c
afs.h
aft.c

diff --git a/afs.c b/afs.c
index 75a4b97..e82e772 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -1008,6 +1008,7 @@ out_close:
        close_afs_tables();
 out:
        signal_shutdown(signal_task);
+       free_status_items();
        free_lpr();
        if (ret < 0)
                PARA_EMERG_LOG("%s\n", para_strerror(-ret));
diff --git a/afs.h b/afs.h
index f506cbf..0bdd76d 100644 (file)
--- a/afs.h
+++ b/afs.h
@@ -254,6 +254,7 @@ int get_afhi_of_row(const struct osl_row *row, struct afh_info *afhi);
 int get_audio_file_path_of_row(const struct osl_row *row, char **path);
 int audio_file_loop(void *private_data, osl_rbtree_loop_func *func);
 int aft_check_callback(struct afs_callback_arg *aca);
+void free_status_items(void);
 
 /* playlist */
 int playlist_open(const char *name);
diff --git a/aft.c b/aft.c
index b863f22..f9512c7 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -978,7 +978,7 @@ out:
        WRITE_STATUS_ITEM(pb, SI_file_size, "%ld\n", statbuf.st_size / 1024);
 }
 
-static void free_status_items(void)
+void free_status_items(void)
 {
        freep(&status_items);
        freep(&parser_friendly_status_items);