]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
audiod: Fix some memory leaks in the com_stat() error paths.
authorAndre Noll <maan@systemlinux.org>
Sat, 18 Jul 2009 12:22:25 +0000 (14:22 +0200)
committerAndre Noll <maan@systemlinux.org>
Sat, 18 Jul 2009 12:22:25 +0000 (14:22 +0200)
audiod_command.c

index ca1bff5b807de5b75b833740bc5ac84c90345bb5..5bd511df7693a1c6713b2c95917791a1a72d2d39 100644 (file)
@@ -187,10 +187,11 @@ int com_stat(int fd, int argc, char **argv)
                int slot_num = get_play_time_slot_num();
                char *ts = get_time_string(slot_num);
                if (ts) {
+                       PARA_ERROR_LOG("play time: %s\n", ts);
                        ret = client_write(fd, ts);
+                       free(ts);
                        if (ret < 0)
                                goto out;
-                       free(ts);
                }
        }
        if (mask & (one << SI_AUDIOD_UPTIME)) {
@@ -199,23 +200,23 @@ int com_stat(int fd, int argc, char **argv)
                        status_item_list[SI_AUDIOD_UPTIME], us);
                free(us);
                ret = client_write(fd, tmp);
+               free(tmp);
                if (ret < 0)
                        goto out;
-               free(tmp);
        }
        if (mask & (one << SI_AUDIOD_STATUS)) {
                char *s = audiod_status_string();
                ret = client_write(fd, s);
+               free(s);
                if (ret < 0)
                        goto out;
-               free(s);
        }
        if (mask & (one << SI_DECODER_FLAGS)) {
                char *df = decoder_flags();
                ret = client_write(fd, df);
+               free(df);
                if (ret < 0)
                        goto out;
-               free(df);
        }
        FOR_EACH_STATUS_ITEM(i) {
                char *tmp, *v;