mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-05 21:34:17 +01:00
wrlib/tests: fix testgrad memory leak
cppcheck is reporting: [wrlib/tests/testgrad.c:148]: (error) Memory leak: color_name but seems some other variables were never freed. This patch is cleaning them property.
This commit is contained in:
committed by
Carlos R. Mafra
parent
16045a6be4
commit
d0bb7ae0c8
@@ -135,15 +135,28 @@ int main(int argc, char **argv)
|
||||
imgd = RRenderMultiGradient(250, 250, colors, RGRD_DIAGONAL);
|
||||
RConvertImage(ctx, imgh, &pix);
|
||||
XCopyArea(dpy, pix, win, ctx->copy_gc, 0, 0, 250, 250, 0, 0);
|
||||
RReleaseImage(imgh);
|
||||
|
||||
RConvertImage(ctx, imgv, &pix);
|
||||
XCopyArea(dpy, pix, win, ctx->copy_gc, 0, 0, 250, 250, 250, 0);
|
||||
RReleaseImage(imgv);
|
||||
|
||||
RConvertImage(ctx, imgd, &pix);
|
||||
XCopyArea(dpy, pix, win, ctx->copy_gc, 0, 0, 250, 250, 500, 0);
|
||||
RReleaseImage(imgd);
|
||||
|
||||
XFlush(dpy);
|
||||
|
||||
getchar();
|
||||
|
||||
free(color_name);
|
||||
for (i = 0; i < ncolors + 1; i++)
|
||||
free(colors[i]);
|
||||
free(colors);
|
||||
|
||||
RDestroyContext(ctx);
|
||||
RShutdown();
|
||||
XCloseDisplay(dpy);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user