From: Andre Noll Date: Wed, 12 May 2010 21:22:37 +0000 (+0200) Subject: oss: Fix double free bug on open failure. X-Git-Tag: v0.4.3~28^2 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=a924e1306eaef8444cd5f3b1ed010bca4bcb3f98 oss: Fix double free bug on open failure. If setting the oss parameters (sample format, sample rate, channel count) fails, we end up freeing the private_oss_data struct twice. --- diff --git a/oss_write.c b/oss_write.c index 3ef0d9e8..48545630 100644 --- a/oss_write.c +++ b/oss_write.c @@ -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; }