Hello.

Guess this goes mostly to Raster and Cedric. Or anyone else who feels 
familiar with the eina mp one-big code.

I had a "fix" sittign here for a some time where I never was sure if it 
is correct or not. I somehow have the feeling that I missed some of the 
code logic and this is actually all correct and how it should be. We 
should add a coment in the code for this then. :)

Specifically I talk about this:
http://git.enlightenment.org/core/efl.git/commit/?h=devs/stefan/eina-mp-fix&id=cdfceacb24f1b157d47beeb02933302248e388ad


   retry_smaller:
     eina_error_set(0);
-   mem = malloc(sizeof(Eina_Inlist) + pool->item_size);
+   mem = calloc(1, sizeof(Eina_Inlist) + pool->item_size);
     if (!mem)
        eina_error_set(EINA_ERROR_OUT_OF_MEMORY);
     else
       {
          pool->over++;
-        memset(mem, 0, sizeof(Eina_Inlist));
          pool->over_list = eina_inlist_append(pool->over_list,
                                               (Eina_Inlist *)mem);
          mem = ((unsigned char *)mem) + sizeof(Eina_Inlist);

The memory allocated and assigned to mem is pool->item_size bigger than 
the region we memset later. It that on purpose? For me it looks like an 
oversight and the calloc should be better suited here.

regards
Stefan Schmidt

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to