Skip to content

picture_pool: fix uninitialized warnings

In the case count=0, the loop is not processed and the picture array's single element is not initialized, leading to a warning. We don't use count=0 anyway so remove the case.

Fix the warnings ( is the VLA):

../../src/misc/picture_pool.c: In function ‘picture_pool_NewFromFormat’:
../../src/misc/picture_pool.c:140:28: warning: ‘<unknown>’ may be used uninitialized [-Wmaybe-uninitialized]
  140 |     picture_pool_t *pool = picture_pool_New(count, picture);
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/misc/picture_pool.c:102:17: note: by argument 2 of type ‘picture_t * const*’ to ‘picture_pool_New’ declared here
  102 | picture_pool_t *picture_pool_New(unsigned count, picture_t *const *tab)
      |                 ^~~~~~~~~~~~~~~~
Edited by Alexandre Janniaux

Merge request reports