diff options
author | Adam Jackson <ajax@nwnk.net> | 2006-04-03 01:10:02 +0000 |
---|---|---|
committer | Adam Jackson <ajax@nwnk.net> | 2006-04-03 01:10:02 +0000 |
commit | 9779025f33c917b74349200e6018d0c94d6ff0ab (patch) | |
tree | ee86c1c43d07cf84e42148b1ab14b84194d97921 /src/Xrender.c | |
parent | ab1b6bdbce1c83c53ef9ea610466a7c813ab643d (diff) |
Coverity #428: Fix a potential NULL chase. Coverity #930: Verify that aXORG-7_0_99_901
malloc succeeds.
Diffstat (limited to 'src/Xrender.c')
-rw-r--r-- | src/Xrender.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/Xrender.c b/src/Xrender.c index 8d8aeb9..3a51663 100644 --- a/src/Xrender.c +++ b/src/Xrender.c @@ -294,7 +294,7 @@ static int XRenderCloseDisplay (Display *dpy, XExtCodes *codes) { XRenderExtDisplayInfo *info = XRenderFindDisplay (dpy); - if (info->info) XFree (info->info); + if (info && info->info) XFree (info->info); return XRenderExtRemoveDisplay (&XRenderExtensionInfo, dpy); } @@ -463,16 +463,6 @@ XRenderQueryFormats (Display *dpy) rep.numScreens * sizeof (XRenderScreen) + rep.numDepths * sizeof (XRenderDepth) + rep.numVisuals * sizeof (XRenderVisual)); - xri->major_version = async_state.major_version; - xri->minor_version = async_state.minor_version; - xri->format = (XRenderPictFormat *) (xri + 1); - xri->nformat = rep.numFormats; - xri->screen = (XRenderScreen *) (xri->format + rep.numFormats); - xri->nscreen = rep.numScreens; - xri->depth = (XRenderDepth *) (xri->screen + rep.numScreens); - xri->ndepth = rep.numDepths; - xri->visual = (XRenderVisual *) (xri->depth + rep.numDepths); - xri->nvisual = rep.numVisuals; rlength = (rep.numFormats * sizeof (xPictFormInfo) + rep.numScreens * sizeof (xPictScreen) + rep.numDepths * sizeof (xPictDepth) + @@ -490,6 +480,16 @@ XRenderQueryFormats (Display *dpy) SyncHandle (); return 0; } + xri->major_version = async_state.major_version; + xri->minor_version = async_state.minor_version; + xri->format = (XRenderPictFormat *) (xri + 1); + xri->nformat = rep.numFormats; + xri->screen = (XRenderScreen *) (xri->format + rep.numFormats); + xri->nscreen = rep.numScreens; + xri->depth = (XRenderDepth *) (xri->screen + rep.numScreens); + xri->ndepth = rep.numDepths; + xri->visual = (XRenderVisual *) (xri->depth + rep.numDepths); + xri->nvisual = rep.numVisuals; _XRead (dpy, (char *) xData, rlength); format = xri->format; xFormat = (xPictFormInfo *) xData; |