[xiph-cvs] cvs commit: vorbis/lib info.c
Michael Smith
msmith at xiph.org
Fri Oct 19 21:57:58 PDT 2001
msmith 01/10/19 21:57:58
Modified: lib info.c
Log:
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.
Revision Changes Path
1.48 +3 -2 vorbis/lib/info.c
Index: info.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/info.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- info.c 2001/10/14 06:52:07 1.47
+++ info.c 2001/10/20 04:57:57 1.48
@@ -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 @@
(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;
}
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list