gdi: fix nullification of instance->context->cache
authorNorbert Federa <norbert.federa@thincast.com>
Thu, 14 May 2015 18:33:21 +0000 (20:33 +0200)
committerNorbert Federa <norbert.federa@thincast.com>
Thu, 14 May 2015 18:33:21 +0000 (20:33 +0200)
libfreerdp/gdi/gdi.c

index 14430f4..976f1dc 100644 (file)
@@ -1355,10 +1355,12 @@ BOOL gdi_init(freerdp* instance, UINT32 flags, BYTE* buffer)
                goto fail_image_bitmap;
 
        if (!instance->context->cache)
+       {
                if (!(cache = cache_new(instance->settings)))
                        goto fail_cache;
 
-       instance->context->cache = cache;
+               instance->context->cache = cache;
+       }
 
        gdi_register_update_callbacks(instance->update);
 
@@ -1376,7 +1378,11 @@ BOOL gdi_init(freerdp* instance, UINT32 flags, BYTE* buffer)
        return TRUE;
 
 fail_register_graphics:
-       free(cache);
+       if (cache)
+       {
+               instance->context->cache = NULL;
+               free(cache);
+       }
 fail_cache:
        gdi_bitmap_free_ex(gdi->image);
 fail_image_bitmap: