[PATCH libX11] Fix three "use of uninitialized variable" coverity warnings

Peter Hutterer peter.hutterer at who-t.net
Mon May 18 19:42:04 PDT 2015


False positive, if rlen/nbytes are unset we quit early before using it. Still,
initialize it so we don't have to deal with these warnings again.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/FontNames.c | 2 +-
 src/GetFPath.c  | 2 +-
 src/ListExt.c   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/FontNames.c b/src/FontNames.c
index 6fc6b12..21dcafe 100644
--- a/src/FontNames.c
+++ b/src/FontNames.c
@@ -47,7 +47,7 @@ int *actualCount)	/* RETURN */
     int count = 0;
     xListFontsReply rep;
     register xListFontsReq *req;
-    unsigned long rlen;
+    unsigned long rlen = 0;
 
     LockDisplay(dpy);
     GetReq(ListFonts, req);
diff --git a/src/GetFPath.c b/src/GetFPath.c
index 62ba014..8c3f49c 100644
--- a/src/GetFPath.c
+++ b/src/GetFPath.c
@@ -35,7 +35,7 @@ char **XGetFontPath(
     int *npaths)	/* RETURN */
 {
 	xGetFontPathReply rep;
-	unsigned long nbytes;
+	unsigned long nbytes = 0;
 	char **flist = NULL;
 	char *ch = NULL;
 	char *chend;
diff --git a/src/ListExt.c b/src/ListExt.c
index 431ae67..be6b989 100644
--- a/src/ListExt.c
+++ b/src/ListExt.c
@@ -42,7 +42,7 @@ char **XListExtensions(
 	register unsigned i;
 	register int length;
 	register xReq *req;
-	unsigned long rlen;
+	unsigned long rlen = 0;
 
 	LockDisplay(dpy);
 	GetEmptyReq (ListExtensions, req);
-- 
2.3.5



More information about the xorg-devel mailing list