aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/xkb/xkb.c
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2006-04-07 16:07:50 +0000
committerMike DePaulo <mikedep333@gmail.com>2015-02-17 21:21:20 -0500
commitd6ce946f9c0bb5746b8333b3f589aa8527739431 (patch)
tree0c431669550f08656eb0359846bf38affff6e041 /nx-X11/programs/Xserver/xkb/xkb.c
parentc910bf7cd3c5a7ec079fee08234f51dea0deb576 (diff)
downloadnx-libs-d6ce946f9c0bb5746b8333b3f589aa8527739431.tar.gz
nx-libs-d6ce946f9c0bb5746b8333b3f589aa8527739431.tar.bz2
nx-libs-d6ce946f9c0bb5746b8333b3f589aa8527739431.zip
Coverity #844, #845, #846: Fix memory leaks.
v2: backport to nx-libs 3.6.x as a prereq for the CVE-2015-0255 fix (Mike DePaulo)
Diffstat (limited to 'nx-X11/programs/Xserver/xkb/xkb.c')
-rw-r--r--nx-X11/programs/Xserver/xkb/xkb.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/nx-X11/programs/Xserver/xkb/xkb.c b/nx-X11/programs/Xserver/xkb/xkb.c
index 240509079..2561c8959 100644
--- a/nx-X11/programs/Xserver/xkb/xkb.c
+++ b/nx-X11/programs/Xserver/xkb/xkb.c
@@ -4794,9 +4794,20 @@ char * wire;
for (i=0;i<req->nProperties;i++) {
char *name,*val;
name= _GetCountedString(&wire,client->swapped);
+ if (!name)
+ return BadAlloc;
val= _GetCountedString(&wire,client->swapped);
- if ((!name)||(!val)||(XkbAddGeomProperty(geom,name,val)==NULL))
+ if (!val) {
+ xfree(name);
+ return BadAlloc;
+ }
+ if (XkbAddGeomProperty(geom,name,val)==NULL) {
+ xfree(name);
+ xfree(val);
return BadAlloc;
+ }
+ xfree(name);
+ xfree(val);
}
if (req->nColors<2) {
@@ -4813,15 +4824,20 @@ char * wire;
}
if (req->labelColorNdx==req->baseColorNdx) {
client->errorValue= _XkbErrCode3(0x04,req->baseColorNdx,
- req->labelColorNdx);
+ req->labelColorNdx);
return BadMatch;
}
for (i=0;i<req->nColors;i++) {
char *name;
name= _GetCountedString(&wire,client->swapped);
- if ((!name)||(!XkbAddGeomColor(geom,name,geom->num_colors)))
+ if (!name)
+ return BadAlloc;
+ if (!XkbAddGeomColor(geom,name,geom->num_colors)) {
+ xfree(name);
return BadAlloc;
+ }
+ xfree(name);
}
if (req->nColors!=geom->num_colors) {
client->errorValue= _XkbErrCode3(0x05,req->nColors,geom->num_colors);