From 3f511ecda02e4f8970c5b90d5ded8d53d2da312a Mon Sep 17 00:00:00 2001 From: "rafael@riseup.net" Date: Tue, 28 May 2013 14:36:12 +0000 Subject: [PATCH] fix for opus memory allocation error by Fred, of radio panik --- darkice/trunk/src/OpusLibEncoder.cpp | 2 +- darkice/trunk/src/OpusLibEncoder.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/darkice/trunk/src/OpusLibEncoder.cpp b/darkice/trunk/src/OpusLibEncoder.cpp index cd2b2ea..3a56988 100644 --- a/darkice/trunk/src/OpusLibEncoder.cpp +++ b/darkice/trunk/src/OpusLibEncoder.cpp @@ -240,7 +240,7 @@ OpusLibEncoder :: open ( void ) strncpy(name, "Darkice Stream", 39); } tags[0].tag_len = strlen(titlestr) + strlen(name); - tags[0].tag_str = (char*) malloc( tags[0].tag_len ); + tags[0].tag_str = (char*) malloc( tags[0].tag_len + 1 ); if( tags[0].tag_str == NULL ) { throw Exception( __FILE__, __LINE__, "malloc failed"); } diff --git a/darkice/trunk/src/OpusLibEncoder.h b/darkice/trunk/src/OpusLibEncoder.h index d53a46d..5bfc928 100644 --- a/darkice/trunk/src/OpusLibEncoder.h +++ b/darkice/trunk/src/OpusLibEncoder.h @@ -93,7 +93,7 @@ struct OpusIdHeader { inline int buildPacket( unsigned char** packet) throw ( Exception ) { int i = 0; // FIXME - doesn't support multistream - unsigned char* out = (unsigned char*)malloc(15); + unsigned char* out = (unsigned char*)malloc(19); if( out == NULL ) { throw Exception( __FILE__, __LINE__, "cannot alloc buffer"); }