aboutsummaryrefslogtreecommitdiffstats
path: root/lib/misc.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-08-08 16:25:13 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2010-08-08 16:25:13 +0100
commitee6cc946dc4ee82cb641df94a6ba101e99253af2 (patch)
treeb9e2586c5f810f6b87a431dc61776305cafcea8c /lib/misc.c
parentbc090f0c3bc243de277a8e04f906384838d95e35 (diff)
Use local memory in http_encode() instead of malloc().
Diffstat (limited to 'lib/misc.c')
-rw-r--r--lib/misc.c7
1 files changed, 2 insertions, 5 deletions
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. */