summaryrefslogtreecommitdiff
path: root/xkb
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2006-04-07 16:07:50 +0000
committerDaniel Stone <daniel@fooishbar.org>2006-04-07 16:07:50 +0000
commit47bdc9528c2dd4ea9d59a0944c023173ea7a7a66 (patch)
tree4135bfade7dc9f17b605358dcbe8fdd24bb98c93 /xkb
parent2c90c3bfef8563f739a72bb645dd52b35b6ff6d5 (diff)
Coverity #844, #845, #846: Fix memory leaks.
Diffstat (limited to 'xkb')
-rw-r--r--xkb/xkb.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/xkb/xkb.c b/xkb/xkb.c
index fdfd2f3cd..376d6de21 100644
--- a/xkb/xkb.c
+++ b/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);