diff options
author | Brian Gix <brian.gix@intel.com> | 2022-06-30 14:10:13 -0700 |
---|---|---|
committer | Brian Gix <brian.gix@intel.com> | 2022-09-22 14:02:38 -0700 |
commit | 75ba186a9ccd88b7fc871d5d1c6da3f7ac7c29b4 (patch) | |
tree | 7ebb7f19148dcbb2d2cdea92b0805a87d060ea8e /mesh | |
parent | 0da759f1a36d67ce1d6c84be03ec3986633ca30c (diff) | |
download | bluez-75ba186a9ccd88b7fc871d5d1c6da3f7ac7c29b4.tar.gz |
mesh: Fix potential memory leak
This memory leak will never happen, however since we added a new
return from function that malloc'd memory, the free should still be
done.
Diffstat (limited to 'mesh')
-rw-r--r-- | mesh/mesh-config-json.c | 4 |
1 files changed, 3 insertions, 1 deletions
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); |