uwac: Fix leak found by covscan
authorOndrej Holy <oholy@redhat.com>
Mon, 20 Aug 2018 07:33:42 +0000 (09:33 +0200)
committerOndrej Holy <oholy@redhat.com>
Wed, 22 Aug 2018 12:34:02 +0000 (14:34 +0200)
leaked_storage: Variable "data" going out of scope leaks the storage it points to.
copy_paste_error: "opaque_region" in "w->opaque_region" looks like a copy-paste error.

uwac/libuwac/uwac-window.c

index 343c1ef..324c520 100644 (file)
@@ -331,6 +331,7 @@ int UwacWindowShmAllocBuffers(UwacWindow* w, int nbuffers, int allocSize, uint32
 
        if (!pool)
        {
+               munmap(data, allocSize * nbuffers);
                ret = UWAC_ERROR_NOMEMORY;
                goto error_mmap;
        }
@@ -500,7 +501,7 @@ UwacReturnCode UwacDestroyWindow(UwacWindow** pwindow)
                wl_region_destroy(w->opaque_region);
 
        if (w->input_region)
-               wl_region_destroy(w->opaque_region);
+               wl_region_destroy(w->input_region);
 
        wl_surface_destroy(w->surface);
        wl_list_remove(&w->link);