Change-Id: I06a0776c03c2fa175d9b194259c170b37585685c
Signed-off-by: Daehyeon Jung <darrenh.jung@samsung.com>
return -1;
}
g_hash_table_remove(__viewer_tbl, id);
+
+ if (surface->id)
+ free(surface->id);
+
free(surface);
return 0;
}
}
- surface = (struct __surface_s *)malloc(sizeof(struct __surface_s));
+ surface = g_hash_table_lookup(__viewer_tbl, id);
+ if (surface) {
+ _E("%s handler is already exist");
+ return -1;
+ }
+
+ surface = (struct __surface_s *)calloc(1, sizeof(struct __surface_s));
if (!surface) {
_E("out of memory");
return -1;