tbm_surface_internal: fix the memory leak 61/260361/1
authorSooChan Lim <sc1.lim@samsung.com>
Thu, 24 Jun 2021 01:56:54 +0000 (10:56 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Thu, 24 Jun 2021 01:59:23 +0000 (10:59 +0900)
Change-Id: I0579184c8ebb4215ad27fc6f43f64bd46bbff494

src/tbm_surface_internal.c

index c9a2e47..251b975 100644 (file)
@@ -797,6 +797,7 @@ _tbm_surface_internal_create_surface(tbm_bufmgr bufmgr, int width, int height, i
                if (!surf->surface_data) {
                        TBM_ERR("tbm_module_alloc_surface_data failed. width:%d height:%d format:%d error:%s",
                                        width, height, format, tbm_error_str(*error));
+                       _tbm_surface_internal_free(surf);
                        return NULL;
                }
        }
@@ -832,6 +833,7 @@ _tbm_surface_internal_import_surface(tbm_bufmgr bufmgr, int width, int height, i
                /* LCOV_EXCL_START */
                TBM_ERR("tbm_module_import_surface_data failed. width:%d height:%d format:%d error:%s",
                                width, height, format, tbm_error_str(*error));
+               _tbm_surface_internal_free(surf);
                return NULL;
                /* LCOV_EXCL_STOP */
        }