Coverity #844, #845, #846: Fix memory leaks.

This commit is contained in:
Daniel Stone 2006-04-07 16:07:50 +00:00
parent 2c90c3bfef
commit 47bdc9528c
2 changed files with 22 additions and 3 deletions

View File

@ -6,6 +6,9 @@
* xkb/xkbEvents.c:
Coverity #987: Avoid potential NULL dereference.
* xkb/xkb.c:
Coverity #844, #845, #846: Fix memory leaks.
2006-04-06 Keith Packard <keithp@keithp.com>
* fb/fbstipple.c: (fbEvenStipple):

View File

@ -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);