display & fb_pool: Clean up memory leaks
parent
77d8efcbe3
commit
2095913688
|
@ -40,8 +40,10 @@ struct nvnc_display* nvnc_display_new(uint16_t x_pos, uint16_t y_pos)
|
||||||
|
|
||||||
static void nvnc__display_free(struct nvnc_display* self)
|
static void nvnc__display_free(struct nvnc_display* self)
|
||||||
{
|
{
|
||||||
if (self->buffer)
|
if (self->buffer) {
|
||||||
|
nvnc_fb_release(self->buffer);
|
||||||
nvnc_fb_unref(self->buffer);
|
nvnc_fb_unref(self->buffer);
|
||||||
|
}
|
||||||
free(self);
|
free(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,7 @@ static void nvnc_fb_pool__destroy_fbs(struct nvnc_fb_pool* self)
|
||||||
struct fbq_item* item = TAILQ_FIRST(&self->fbs);
|
struct fbq_item* item = TAILQ_FIRST(&self->fbs);
|
||||||
TAILQ_REMOVE(&self->fbs, item, link);
|
TAILQ_REMOVE(&self->fbs, item, link);
|
||||||
nvnc_fb_unref(item->fb);
|
nvnc_fb_unref(item->fb);
|
||||||
|
free(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,10 +153,11 @@ void nvnc_fb_pool_release(struct nvnc_fb_pool* self, struct nvnc_fb* fb)
|
||||||
{
|
{
|
||||||
if (fb->width != self->width || fb->height != self->height ||
|
if (fb->width != self->width || fb->height != self->height ||
|
||||||
fb->fourcc_format != self->fourcc_format) {
|
fb->fourcc_format != self->fourcc_format) {
|
||||||
nvnc_fb_unref(fb);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nvnc_fb_ref(fb);
|
||||||
|
|
||||||
struct fbq_item* item = calloc(1, sizeof(*item));
|
struct fbq_item* item = calloc(1, sizeof(*item));
|
||||||
assert(item);
|
assert(item);
|
||||||
item->fb = fb;
|
item->fb = fb;
|
||||||
|
|
Loading…
Reference in New Issue