From 6c57eeb7ad496afd1fd74b1133542e40e86b0875 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Mon, 16 Jan 2012 22:33:52 +0200 Subject: [PATCH] stream_vcd: fix option value allocated with strdup A string freed with m_struct_free() was allocated with strdup(). This would cause a crash when using vcd:// streams. Fix to use talloc_strdup(). --- stream/stream_vcd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stream/stream_vcd.c b/stream/stream_vcd.c index 094cd98fe8..5d2eecc27b 100644 --- a/stream/stream_vcd.c +++ b/stream/stream_vcd.c @@ -37,6 +37,8 @@ #endif #include +#include "talloc.h" + #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) #include "vcd_read_fbsd.h" #elif defined(__APPLE__) @@ -157,9 +159,9 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) { if (!p->device) { if(cdrom_device) - p->device = strdup(cdrom_device); + p->device = talloc_strdup(NULL, cdrom_device); else - p->device = strdup(DEFAULT_CDROM_DEVICE); + p->device = talloc_strdup(NULL, DEFAULT_CDROM_DEVICE); } #if defined(__MINGW32__) || defined(__CYGWIN__)