Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 305c4cc9 authored by Sungsoo Lim's avatar Sungsoo Lim
Browse files

Fix memory leak in BNEP_WriteBuf

p_buf should be freed if it fails the confidence check.

Bug: 264319276
Test: m .
Change-Id: Ibcc3dc79195eeaa432d6e91966be6e658d42cad6
parent 791d8705
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -388,7 +388,10 @@ tBNEP_RESULT BNEP_WriteBuf(uint16_t handle, const RawAddress& p_dest_addr,
        protocol = 0;
      else {
        new_len += 4;
        if (new_len > org_len) return BNEP_IGNORE_CMD;
        if (new_len > org_len) {
          osi_free(p_buf);
          return BNEP_IGNORE_CMD;
        }
        p_data[2] = 0;
        p_data[3] = 0;
      }