This fixes the following error:
In function ‘get_composition’,
inlined from ‘cfg_srv_pkt’ at mesh/cfgmod-server.c:801:8:
mesh/cfgmod-server.c:758:9: error: ‘comp’ may be used
uninitialized [-Werror=maybe-uninitialized]
758 | memcpy(buf, comp, len);
| ^~~~~~~~~~~~~~~~~~~~~~
mesh/cfgmod-server.c: In function ‘cfg_srv_pkt’:
mesh/cfgmod-server.c:739:24: note: ‘comp’ was declared here
739 | const uint8_t *comp;
| ^~~~
static uint16_t get_composition(struct mesh_node *node, uint8_t page,
uint8_t *buf)
{
- const uint8_t *comp;
+ const uint8_t *comp = NULL;
uint16_t len = 0;
size_t i;
break;
}
- if (!len)
+ if (!len || !comp)
return 0;
*buf++ = page;