*** jk_uri_worker_map.c.orig	Wed Sep 26 11:53:35 2001
--- jk_uri_worker_map.c	Wed Sep 26 12:25:49 2001
***************
*** 347,357 ****
          unsigned i;
          unsigned best_match = -1;
          unsigned longest_match = 0;
!         char clean_uri[4096];
          char *url_rewrite = strstr(uri, JK_PATH_SESSION_IDENTIFIER);
          
          if(url_rewrite) {
!             strcpy(clean_uri, uri);
              url_rewrite = strstr(clean_uri, JK_PATH_SESSION_IDENTIFIER);
              *url_rewrite = '\0';
              uri = clean_uri;
--- 347,357 ----
          unsigned i;
          unsigned best_match = -1;
          unsigned longest_match = 0;
!         char *clean_uri=NULL;
          char *url_rewrite = strstr(uri, JK_PATH_SESSION_IDENTIFIER);
          
          if(url_rewrite) {
! 	    clean_uri = strdup(uri);
              url_rewrite = strstr(clean_uri, JK_PATH_SESSION_IDENTIFIER);
              *url_rewrite = '\0';
              uri = clean_uri;
***************
*** 374,379 ****
--- 374,380 ----
  			       "jk_uri_worker_map_t::map_uri_to_worker, Found an exact match %s -> %s\n",
  			       uw_map->maps[i].worker_name,
  			       uw_map->maps[i].context );
+ 			free(clean_uri);
                          return uw_map->maps[i].worker_name;
                      }
                  } else if(MATCH_TYPE_CONTEXT == uw_map->maps[i].match_type) {
***************
*** 418,423 ****
--- 419,425 ----
          }
  
          if(-1 != best_match) {
+ 	    free(clean_uri);
              return uw_map->maps[best_match].worker_name;
          } else {
              /*
***************
*** 433,439 ****
              if(fraud >= 0) {
                  jk_log(l, JK_LOG_EMERG, 
                         "In jk_uri_worker_map_t::map_uri_to_worker, found a security fraud in '%s'\n",
!                        uri);    
                  return uw_map->maps[fraud].worker_name;
              }
         }        
--- 435,442 ----
              if(fraud >= 0) {
                  jk_log(l, JK_LOG_EMERG, 
                         "In jk_uri_worker_map_t::map_uri_to_worker, found a security fraud in '%s'\n",
!                        uri);
! 		free(clean_uri);
                  return uw_map->maps[fraud].worker_name;
              }
         }        
***************
*** 441,447 ****
          jk_log(l, JK_LOG_ERROR, 
                 "In jk_uri_worker_map_t::map_uri_to_worker, wrong parameters\n");    
      }
- 
      jk_log(l, JK_LOG_DEBUG, 
             "jk_uri_worker_map_t::map_uri_to_worker, done without a match\n"); 
  
--- 444,449 ----
