[xiph-commits] r10547 - icecast/trunk/libshout/src

brendan at svn.xiph.org brendan at svn.xiph.org
Mon Dec 5 19:02:45 PST 2005


Author: brendan
Date: 2005-12-05 19:02:44 -0800 (Mon, 05 Dec 2005)
New Revision: 10547

Modified:
   icecast/trunk/libshout/src/shout.c
Log:
Apply Karl's patch to avoid double-freeing the HTTP response header on unsuccessful
connection.


Modified: icecast/trunk/libshout/src/shout.c
===================================================================
--- icecast/trunk/libshout/src/shout.c	2005-12-06 01:09:24 UTC (rev 10546)
+++ icecast/trunk/libshout/src/shout.c	2005-12-06 03:02:44 UTC (rev 10547)
@@ -1181,7 +1181,7 @@
 static int parse_http_response(shout_t *self)
 {
 	http_parser_t *parser;
-	char *header;
+	char *header = NULL;
 	int hlen = 0;
 	int code;
 	char *retcode;
@@ -1198,11 +1198,11 @@
 	parser = httpp_create_parser();
 	httpp_initialize(parser, NULL);
 	if (httpp_parse_response(parser, header, hlen, self->mount)) {
-		free (header);
 		retcode = httpp_getvar(parser, HTTPP_VAR_ERROR_CODE);
 		code = atoi(retcode);
 		if(code >= 200 && code < 300) {
 			httpp_destroy(parser);
+			free (header);
 			return SHOUTERR_SUCCESS;
 		}
 	}



More information about the commits mailing list