X-Git-Url: https://git.octo.it/?p=libopano.git;a=blobdiff_plain;f=src%2Fviewer.c;fp=src%2Fviewer.c;h=3494d19df0b4ee45d450d609da3831403ab92368;hp=7516db22629c70e911e4fb17827de0ffb5179812;hb=e8d9022f32f7fedb8de1c86231d5db506ba8411f;hpb=ef898eaf886f1d176fed003b04f99f24d0c857fb diff --git a/src/viewer.c b/src/viewer.c index 7516db2..3494d19 100644 --- a/src/viewer.c +++ b/src/viewer.c @@ -134,13 +134,13 @@ static int draw_window (const ui_image_t *img) if ((ximage != NULL) && ((img->width != ximage->width) || (img->height != ximage->height))) { free (ximage->data); + ximage->data = NULL; XDestroyImage (ximage); ximage = NULL; } if (ximage == NULL) { - char *data; ximage = XCreateImage(disp_g, visual_g, depth_g, ZPixmap, 0, NULL, img->width, img->height, 8, 0); @@ -149,8 +149,7 @@ static int draw_window (const ui_image_t *img) ximage->byte_order= MSBFirst; - data = (char *) malloc (img->width * img->height * depth_g / 8); - ximage->data = data; + ximage->data = (char *) malloc (img->width * img->height * depth_g / 8); if (ximage->data == NULL) { XDestroyImage (ximage);