[vlc-devel] commit: libvlc: Fix a typo in a memcpy and constify. (Pierre d'Herbemont )

jpd at videolan.org jpd at videolan.org
Fri Jun 5 09:10:48 CEST 2009


On Fri, Jun 05, 2009 at 07:34:57AM +0200, git version control wrote:
> vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Thu Jun  4 22:32:54 2009 -0700| [3c7efc2ecae921e52db9fea584c1405c20156c8b] | committer: Pierre d'Herbemont 
> -    ret = malloc( sizeof(int)*(old_depth+2) );
> -    memcpy( ret, path, sizeof(int)*(old_depth+2) );
> +    ret = malloc( sizeof(int) * (old_depth + 2) );
> +    memcpy( ret, path, sizeof(int) * old_depth );
>      ret[old_depth] = index;

In case of ENOMEM, is there anything besides segfaulting we can do here?

In a related musing, would it be desirable to have a vlc_{m,c,re}alloc()
that bails with an "out of memory" message and save some checks in
various other parts of the code?




More information about the vlc-devel mailing list