[lxc-devel] [PATCH] Fix compile warning on uninitialized return value

Stéphane Graber stgraber at ubuntu.com
Tue Dec 25 12:00:55 UTC 2012


On 12/21/2012 04:34 PM, Kyle Russell wrote:
> Hi,
> 
> Please consider the following patch for your next release.
> 
> cgroup's mount_has_subsystem returns the first subsystem
> found or NULL if no subsystem was found; however, the return
> value is never initialized, so it's not guaranteed to return NULL.
> 
> Signed-off-by: Kyle Russell <bkylerussell at gmail.com
> <mailto:bkylerussell at gmail.com>>

Looks good, Acked and applied.

> ---
>  src/lxc/cgroup.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c
> index b6c948b..f6243b8 100644
> --- a/src/lxc/cgroup.c
> +++ b/src/lxc/cgroup.c
> @@ -59,7 +59,7 @@ enum {
>  static char *mount_has_subsystem(const struct mntent *mntent)
>  {
>  FILE *f;
> -char *c, *ret;
> +char *c, *ret = NULL;
>  char line[MAXPATHLEN];
>  
>  /* read the list of subsystems from the kernel */
> -- 
> 1.7.10.2.4.g36f8dc1
> 
> 
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
> 
> 
> 
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel
> 


-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 899 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20121225/751cd3a3/attachment.pgp>


More information about the lxc-devel mailing list