[vlc-commits] quartztext: don't mangle const string
Pierre Ynard
git at videolan.org
Fri Jan 21 12:50:47 CET 2011
vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Fri Jan 21 12:50:36 2011 +0100| [88388e212062a026f2d1948c350202a2e4f0f3f8] | committer: Pierre Ynard
quartztext: don't mangle const string
Untested
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=88388e212062a026f2d1948c350202a2e4f0f3f8
---
modules/misc/quartztext.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/modules/misc/quartztext.c b/modules/misc/quartztext.c
index ec28027..f8277dc 100644
--- a/modules/misc/quartztext.c
+++ b/modules/misc/quartztext.c
@@ -741,7 +741,10 @@ static int ProcessNodes( filter_t *p_filter,
int len;
// Turn any multiple-whitespaces into single spaces
- char *s = strpbrk( node, "\t\r\n " );
+ char *dup = strdup( node );
+ if( !dup )
+ break;
+ char *s = strpbrk( dup, "\t\r\n " );
while( s )
{
int i_whitespace = strspn( s, "\t\r\n " );
@@ -757,7 +760,7 @@ static int ProcessNodes( filter_t *p_filter,
CFMutableAttributedStringRef p_attrnode = CFAttributedStringCreateMutable(kCFAllocatorDefault, 0);
- p_cfString = CFStringCreateWithCString( NULL, node, kCFStringEncodingUTF8 );
+ p_cfString = CFStringCreateWithCString( NULL, dup, kCFStringEncodingUTF8 );
CFAttributedStringReplaceString( p_attrnode, CFRangeMake(0, 0), p_cfString );
CFRelease( p_cfString );
len = CFAttributedStringGetLength( p_attrnode );
@@ -771,6 +774,7 @@ static int ProcessNodes( filter_t *p_filter,
p_attrnode);
CFRelease( p_attrnode );
+ free( dup );
break;
}
}
More information about the vlc-commits
mailing list