From: Mike Smith Date: Sat, 20 Oct 2001 04:57:57 +0000 (+0000) Subject: Change a single strdup() call to do _ogg_malloc(), then strcpy. This ensures X-Git-Tag: v1.3.3~896 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d9a413116f316e5a79d4fe5a815a5c2d85eceb51;p=platform%2Fupstream%2Flibvorbis.git 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 --- 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; }