tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c
Date Sat, 12 Feb 2005 16:59:45 GMT
mturk       2005/02/12 08:59:45

  Modified:    jk/native/common jk_lb_worker.c
  Log:
  Check if malloc has failed before using that memory, not after.
  
  Revision  Changes    Path
  1.45      +6 -5      jakarta-tomcat-connectors/jk/native/common/jk_lb_worker.c
  
  Index: jk_lb_worker.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_lb_worker.c,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- jk_lb_worker.c	12 Feb 2005 11:32:12 -0000	1.44
  +++ jk_lb_worker.c	12 Feb 2005 16:59:45 -0000	1.45
  @@ -574,6 +574,11 @@
               p->lb_workers = jk_pool_alloc(&p->p,
                                             num_of_workers *
                                             sizeof(worker_record_t));
  +            if (!p->lb_workers) {
  +                JK_TRACE_EXIT(l);
  +                return JK_FALSE;
  +            }
  +
               for (i = 0; i < num_of_workers; i++) {
                   p->lb_workers[i].s = jk_shm_alloc(&p->p, sizeof(jk_shm_worker_t));
                   if (p->lb_workers[i].s == NULL) {
  @@ -581,10 +586,6 @@
                       return JK_FALSE;
                   }
               }
  -            if (!p->lb_workers) {
  -                JK_TRACE_EXIT(l);
  -                return JK_FALSE;
  -            }
   
               for (i = 0; i < num_of_workers; i++) {
                   strncpy(p->lb_workers[i].s->name, worker_names[i],
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message