From ee6cc946dc4ee82cb641df94a6ba101e99253af2 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 8 Aug 2010 16:25:13 +0100 Subject: Use local memory in http_encode() instead of malloc(). --- lib/misc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'lib/misc.c') diff --git a/lib/misc.c b/lib/misc.c index fe2ff17c..04418524 100644 --- a/lib/misc.c +++ b/lib/misc.c @@ -263,11 +263,10 @@ void http_decode( char *s ) /* This fuction is safe, but make sure you call it safely as well! */ void http_encode( char *s ) { - char *t; + char t[strlen(s)+1]; int i, j; - t = g_strdup( s ); - + strcpy( t, s ); for( i = j = 0; t[i]; i ++, j ++ ) { /* if( t[i] <= ' ' || ((unsigned char *)t)[i] >= 128 || t[i] == '%' ) */ @@ -282,8 +281,6 @@ void http_encode( char *s ) } } s[j] = 0; - - g_free( t ); } /* Strip newlines from a string. Modifies the string passed to it. */ -- cgit v1.2.3