cvs: /php4/ext/standard url.c
| From: | Thies C. Arntzen | Date: | Wed, 16 Feb 2000 11:47:21 +0000 |
| Subject: | cvs: /php4/ext/standard url.c | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-10334@lists.php.net to get a copy of this message | ||
thies Wed Feb 16 03:47:21 2000 EDT
Modified files:
/php4/ext/standard url.c
Log:
(url_parse) only free regex if compile worked.
Index: php4/ext/standard/url.c
diff -u php4/ext/standard/url.c:1.21 php4/ext/standard/url.c:1.22
--- php4/ext/standard/url.c:1.21 Wed Feb 16 03:41:49 2000
+++ php4/ext/standard/url.c Wed Feb 16 03:47:20 2000
@@ -15,7 +15,7 @@
| Author: Jim Winstead (jimw@php.net) |
+----------------------------------------------------------------------+
*/
-/* $Id: url.c,v 1.21 2000/02/16 11:41:49 thies Exp $ */
+/* $Id: url.c,v 1.22 2000/02/16 11:47:20 thies Exp $ */
#include <stdlib.h>
#include <string.h>
@@ -108,13 +108,15 @@
/* extract the username, pass, and port from the hostname */
if (subs[4].rm_so != -1 && subs[4].rm_so < length) {
+
+ int cerr;
/* extract username:pass@host:port from regex results */
result = estrndup(str + subs[4].rm_so, subs[4].rm_eo - subs[4].rm_so);
length = strlen(result);
regfree(&re); /* free the old regex */
- if ((err=regcomp(&re, "^(([^@:]+)(:([^@:]+))?@)?([^:@]+)(:([^:@]+))?",
REG_EXTENDED))
+ if ((cerr=regcomp(&re, "^(([^@:]+)(:([^@:]+))?@)?([^:@]+)(:([^:@]+))?",
REG_EXTENDED))
|| (err=regexec(&re, result, 10, subs, 0))) {
STR_FREE(ret->scheme);
STR_FREE(ret->path);
@@ -123,7 +125,7 @@
efree(ret);
efree(result);
/*php_error(E_WARNING,"Unable to compile regex: %d\n", err);*/
- regfree(&re);
+ if (!cerr) regfree(&re);
return NULL;
}
/* now deal with all of the results */