This commit is contained in:
akallabeth 2024-08-07 09:35:51 +02:00 committed by Armin Novak
parent 9fe1ff0165
commit 711dbb53ab
No known key found for this signature in database
GPG Key ID: 2CF4A2D2D3D72105

View File

@ -30,6 +30,7 @@
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
int rc = 1;
GC gc = NULL; GC gc = NULL;
int depth = 0; int depth = 0;
int x = 0; int x = 0;
@ -100,12 +101,12 @@ int main(int argc, char** argv)
engine = rdtk_engine_new(); engine = rdtk_engine_new();
if (!engine) if (!engine)
return 1; goto fail;
scanline = width * 4; scanline = width * 4;
buffer = (uint8_t*)calloc(height, scanline); buffer = (uint8_t*)calloc(height, scanline);
if (!buffer) if (!buffer)
return 1; goto fail;
surface = rdtk_surface_new(engine, buffer, width, height, scanline); surface = rdtk_surface_new(engine, buffer, width, height, scanline);
@ -146,7 +147,10 @@ int main(int argc, char** argv)
XFlush(display); XFlush(display);
XDestroyImage(image); rc = 0;
fail:
if (image)
XDestroyImage(image);
XCloseDisplay(display); XCloseDisplay(display);
rdtk_surface_free(surface); rdtk_surface_free(surface);
@ -154,5 +158,5 @@ int main(int argc, char** argv)
rdtk_engine_free(engine); rdtk_engine_free(engine);
return 0; return rc;
} }