audioc: Fix memory leak in configfile_exists().
[paraslash.git] / oss_write.c
index 80777ea1e616f0b9a14bbcab89e790fac14cb5b9..85357f9379f01c70244754f3c717f23d78864231 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009-2010 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2009-2012 Andre Noll <maan@systemlinux.org>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
@@ -9,9 +9,7 @@
 #include <regex.h>
 #include <sys/ioctl.h>
 #include <fcntl.h>
-#include <dirent.h>
 #include <sys/soundcard.h>
-#include <stdbool.h>
 
 #include "para.h"
 #include "fd.h"
@@ -88,7 +86,6 @@ static int oss_init(struct writer_node *wn, unsigned sample_rate,
        struct oss_write_args_info *conf = wn->conf;
        struct private_oss_write_data *powd = para_calloc(sizeof(*powd));
 
-       wn->private_data = powd;
        PARA_INFO_LOG("opening %s\n", conf->device_arg);
        ret = para_open(conf->device_arg, O_WRONLY, 0);
        if (ret < 0)
@@ -149,6 +146,7 @@ static int oss_init(struct writer_node *wn, unsigned sample_rate,
                        sample_rate);
        }
        wn->min_iqs = powd->bytes_per_frame;
+       wn->private_data = powd;
        return 1;
 err:
        close(powd->fd);
@@ -185,7 +183,7 @@ static void oss_post_select(__a_unused struct sched *s,
        bytes = btr_next_buffer(btrn, &data);
        frames = bytes / powd->bytes_per_frame;
        if (!frames) { /* eof and less than a single frame available */
-               ret = -E_OSS_EOF;
+               ret = -E_WRITE_COMMON_EOF;
                goto out;
        }
        ret = 0;
@@ -202,10 +200,6 @@ out:
                btr_remove_node(btrn);
 }
 
-static void oss_open(__a_unused struct writer_node *wn)
-{
-}
-
 __malloc static void *oss_parse_config_or_die(const char *options)
 {
        struct oss_write_args_info *conf = para_calloc(sizeof(*conf));
@@ -232,7 +226,6 @@ void oss_write_init(struct writer *w)
        struct oss_write_args_info dummy;
 
        oss_cmdline_parser_init(&dummy);
-       w->open = oss_open;
        w->close = oss_close;
        w->pre_select = oss_pre_select;
        w->post_select = oss_post_select;