On Mon, Aug 2, 2010 at 5:43 PM, Enlightenment SVN
<no-re...@enlightenment.org> wrote:
> Log:
>  Check return value for realloc
> Author:       englebass
> Date:         2010-08-02 13:43:09 -0700 (Mon, 02 Aug 2010)
> New Revision: 50753
>
> Modified:
>  trunk/efreet/src/lib/efreet_desktop.c 
> trunk/efreet/src/lib/efreet_desktop_command.c
>
> Modified: trunk/efreet/src/lib/efreet_desktop.c
> ===================================================================
> --- trunk/efreet/src/lib/efreet_desktop.c       2010-08-02 20:34:41 UTC (rev 
> 50752)
> +++ trunk/efreet/src/lib/efreet_desktop.c       2010-08-02 20:43:09 UTC (rev 
> 50753)
> @@ -824,6 +824,7 @@
>         {
>             size = len + pos + 1024;
>             string = realloc(string, size);
> +            if (!string) return NULL;

nooooo... it's wrong, the old string pointer is now lost! You need to
get the return into another tmp variable and swap after you know it
worked.

Lucas, maybe you can add a script to check for x = realloc(x,...)?


-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: barbi...@gmail.com
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to