diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-08-08 16:25:13 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-08-08 16:25:13 +0100 |
commit | ee6cc946dc4ee82cb641df94a6ba101e99253af2 (patch) | |
tree | b9e2586c5f810f6b87a431dc61776305cafcea8c /lib/misc.c | |
parent | bc090f0c3bc243de277a8e04f906384838d95e35 (diff) |
Use local memory in http_encode() instead of malloc().
Diffstat (limited to 'lib/misc.c')
-rw-r--r-- | lib/misc.c | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -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. */ |