From d9a413116f316e5a79d4fe5a815a5c2d85eceb51 Mon Sep 17 00:00:00 2001 From: Mike Smith Date: Sat, 20 Oct 2001 04:57:57 +0000 Subject: [PATCH] Change a single strdup() call to do _ogg_malloc(), then strcpy. This ensures that, since the memory is freed using _ogg_free(), things work right. Otherwise people replacing the ogg memory routines would have problems. svn path=/trunk/vorbis/; revision=2189 --- lib/info.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/info.c b/lib/info.c index 7c542bc..b841116 100644 --- a/lib/info.c +++ b/lib/info.c @@ -11,7 +11,7 @@ ******************************************************************** function: maintain the info structure, info <-> header packets - last mod: $Id: info.c,v 1.47 2001/10/14 06:52:07 msmith Exp $ + last mod: $Id: info.c,v 1.48 2001/10/20 04:57:57 msmith Exp $ ********************************************************************/ @@ -63,8 +63,9 @@ void vorbis_comment_add(vorbis_comment *vc,char *comment){ (vc->comments+2)*sizeof(*vc->user_comments)); vc->comment_lengths=_ogg_realloc(vc->comment_lengths, (vc->comments+2)*sizeof(*vc->comment_lengths)); - vc->user_comments[vc->comments]=strdup(comment); vc->comment_lengths[vc->comments]=strlen(comment); + vc->user_comments[vc->comments]=_ogg_malloc(vc->comment_lengths[vc->comments]+1); + strcpy(vc->user_comments[vc->comments], comment); vc->comments++; vc->user_comments[vc->comments]=NULL; } -- 2.7.4