]> git.tue.mpg.de Git - paraslash.git/commitdiff
oss: Fix double free bug on open failure.
authorAndre Noll <maan@systemlinux.org>
Wed, 12 May 2010 21:22:37 +0000 (23:22 +0200)
committerAndre Noll <maan@systemlinux.org>
Wed, 12 May 2010 21:22:37 +0000 (23:22 +0200)
If setting the oss parameters (sample format, sample rate, channel
count) fails, we end up freeing the private_oss_data struct twice.

oss_write.c

index 3ef0d9e8867c5b692f8cc8b2afc8a47c6fdda7e9..48545630a5d10865c3fc174fdfc7e1bbc6b7c7a6 100644 (file)
@@ -82,7 +82,8 @@ static void oss_close(struct writer_node *wn)
 {
        struct private_oss_write_data *powd = wn->private_data;
 
-       close(powd->fd);
+       if (powd->fd >= 0)
+               close(powd->fd);
        free(powd);
 }
 
@@ -175,7 +176,7 @@ static int oss_open(struct writer_node *wn)
        return 1;
 err:
        close(powd->fd);
-       free(powd);
+       powd->fd = -1;
        return ret;
 }