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

Kyle Russell bkylerussell at gmail.com
Fri Dec 21 15:34:34 UTC 2012


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>
---
 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20121221/23d4e1ee/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-compile-warning-on-uninitialized-return-value.patch
Type: application/octet-stream
Size: 912 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20121221/23d4e1ee/attachment.obj>


More information about the lxc-devel mailing list