Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: [OMPI devel] mca_bml_r2_del_btl incorrect memory size reallocation?
From: Christoph Niethammer (niethammer_at_[hidden])
Date: 2014-01-23 03:57:09


Hello

I think I found a minor memory bug in the bml_r2 code in function mca_bml_r2_del_btl but I could not figure out when this function ever gets called.
How can I test this function in a proper way?

Here the diff showing the issue:

@@ -699,11 +699,11 @@ static int mca_bml_r2_del_btl(mca_btl_base_module_t* btl)
     if(!found) {
         /* doesn't even exist */
         goto CLEANUP;
     }
     /* remove from bml list */
- modules = (mca_btl_base_module_t**)malloc(sizeof(mca_btl_base_module_t*) * mca_bml_r2.num_btl_modules-1);
+ modules = (mca_btl_base_module_t**)malloc(sizeof(mca_btl_base_module_t*) * (mca_bml_r2.num_btl_modules-1));
     for(i=0,m=0; i<mca_bml_r2.num_btl_modules; i++) {
         if(mca_bml_r2.btl_modules[i] != btl) {
             modules[m++] = mca_bml_r2.btl_modules[i];
         }
     }

Regards
Christoph

--
Christoph Niethammer
High Performance Computing Center Stuttgart (HLRS)
Nobelstrasse 19
70569 Stuttgart
Tel: ++49(0)711-685-87203
email: niethammer_at_[hidden]
http://www.hlrs.de/people/niethammer