Xext: xvmc: skip reply payload assembly when no data to send
Instead of trying to calloc() zero-size blocks when there's no actual payload to send, skip the whole part. This also helps reducing analyzer noise. Manpages of various BSDs don't tell whether it's safe to pass zero size at all, so it's better not trying to do so. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
0fad1274f2
commit
b70b72077c
14
Xext/xvmc.c
14
Xext/xvmc.c
|
@ -149,8 +149,10 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
|
|||
}
|
||||
|
||||
int num_surfaces = (adaptor) ? adaptor->num_surfaces : 0;
|
||||
xvmcSurfaceInfo *info = calloc(sizeof(xvmcSurfaceInfo), num_surfaces);
|
||||
if (!info && num_surfaces)
|
||||
xvmcSurfaceInfo *info = NULL;
|
||||
if (num_surfaces) {
|
||||
info = calloc(sizeof(xvmcSurfaceInfo), num_surfaces);
|
||||
if (!info)
|
||||
return BadAlloc;
|
||||
|
||||
for (int i = 0; i < num_surfaces; i++) {
|
||||
|
@ -164,6 +166,7 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
|
|||
info[i].mc_type = surface->mc_type;
|
||||
info[i].flags = surface->flags;
|
||||
}
|
||||
}
|
||||
|
||||
xvmcListSurfaceTypesReply rep = {
|
||||
.type = X_Reply,
|
||||
|
@ -542,8 +545,10 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
|
|||
int num = (surface->compatible_subpictures ?
|
||||
surface->compatible_subpictures->num_xvimages : 0);
|
||||
|
||||
xvImageFormatInfo *info = calloc(sizeof(xvImageFormatInfo), num);
|
||||
if (!info && num)
|
||||
xvImageFormatInfo *info = NULL;
|
||||
if (num) {
|
||||
info = calloc(sizeof(xvImageFormatInfo), num);
|
||||
if (!info)
|
||||
return BadAlloc;
|
||||
|
||||
for (int i = 0; i < num; i++) {
|
||||
|
@ -583,6 +588,7 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
|
|||
memcpy(&info[i].comp_order, pImage->component_order, 32);
|
||||
info[i].scanline_order = pImage->scanline_order;
|
||||
}
|
||||
}
|
||||
|
||||
xvmcListSubpictureTypesReply rep = {
|
||||
.type = X_Reply,
|
||||
|
|
Loading…
Reference in New Issue