Message ID | 20220630211313.210017-1-brian.gix@intel.com |
---|---|
State | New |
Headers | show |
Series | [BlueZ] mesh: Fix potential memory leak | expand |
diff --git a/mesh/mesh-config-json.c b/mesh/mesh-config-json.c index 5bb1e5ce0..7f46c8582 100644 --- a/mesh/mesh-config-json.c +++ b/mesh/mesh-config-json.c @@ -1961,8 +1961,10 @@ bool mesh_config_comp_page_add(struct mesh_config *cfg, uint8_t page, len = (size * 2) + 3; buf = l_malloc(len); ret = snprintf(buf, len, "%2.2x", page); - if (ret < 0) + if (ret < 0) { + l_free(buf); return false; + } hex2str(data, size, buf + 2, len - 2);