Free lv_img_dsc_t* error


I run valgrind on my program and I get few memory leak/error when I try to free lv_img_dsc_t*.

My program:

  background                     = (lv_img_dsc_t*) malloc(sizeof(lv_img_dsc_t));
  background->header.always_zero = 0;
  background->          = LV_IMG_CF_TRUE_COLOR_ALPHA;
  background->header.w           = width;
  background->header.h           = height;
  background->data_size          = width * height * 4;



I get that error on valgrind:

==26391==    at 0x19786C: lv_mem_free (lv_mem.c:231)
==26391==    by 0x122EA2: lv_img_buf_free (lv_img_buf.c:370)
==26391==    by 0x11445B: myrealease (screen.c:226)

What do I made wrong?

I don’t use alloc array because I use array from png importe file.
This error lv_mem.c:231 seems to be:

You’re using malloc at one point and lv_img_buf_free (which calls lv_mem_free) at another point. You can’t mix allocators in this manner, unless you are using LV_MEM_CUSTOM == 1, and even then it’s not recommended.

Does the issue go away if you use lv_mem_alloc in place of malloc?