acl: Fix/improve acl_del_entry log message.
[paraslash.git] / aft.c
diff --git a/aft.c b/aft.c
index 1679a5495131117f440a5ee610f677ff14cc5612..b863f22ab9cfd4eed97ac59da1277f26196f8f23 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -1,8 +1,4 @@
-/*
- * Copyright (C) 2007 Andre Noll <maan@tuebingen.mpg.de>
- *
- * Licensed under the GPL v2. For licencing details see COPYING.
- */
+/* Copyright (C) 2007 Andre Noll <maan@tuebingen.mpg.de>, see file COPYING. */
 
 /** \file aft.c Audio file table functions. */
 
@@ -982,6 +978,12 @@ out:
        WRITE_STATUS_ITEM(pb, SI_file_size, "%ld\n", statbuf.st_size / 1024);
 }
 
+static void free_status_items(void)
+{
+       freep(&status_items);
+       freep(&parser_friendly_status_items);
+}
+
 static int make_status_items(void)
 {
        const struct lls_command *cmd = SERVER_CMD_CMD_PTR(LS);
@@ -991,6 +993,7 @@ static int make_status_items(void)
        time_t current_time;
        int ret;
 
+       free_status_items();
        if (!status_item_ls_data.path) /* no audio file open */
                return 0;
        ret = lls_parse(ARRAY_SIZE(argv), argv, cmd, &opts.lpr, NULL);
@@ -1000,23 +1003,20 @@ static int make_status_items(void)
        if (ret < 0)
                goto out;
        make_inode_status_items(&pb);
-       free(status_items);
        status_items = pb.buf;
 
        memset(&pb, 0, sizeof(pb));
        pb.max_size = shm_get_shmmax() - 1;
        pb.flags = PBF_SIZE_PREFIX;
        ret = print_list_item(&status_item_ls_data, &opts, &pb, current_time);
-       if (ret < 0) {
-               free(status_items);
-               status_items = NULL;
-               return ret;
-       }
+       if (ret < 0)
+               goto out;
        make_inode_status_items(&pb);
-       free(parser_friendly_status_items);
        parser_friendly_status_items = pb.buf;
        ret = 1;
 out:
+       if (ret < 0)
+               free_status_items();
        lls_free_parse_result(opts.lpr, cmd);
        return ret;
 }
@@ -2581,6 +2581,7 @@ static int aft_event_handler(enum afs_events event, struct para_buffer *pb,
                 * every time.
                 */
                make_status_items();
+               return 0;
        } default:
                return 0;
        }