Files
openwrt/package/system/mtd/src
Anna Kiri a5107ad58c mtd: fix buffer leak and fd leak in mtd_dump()
Two leaks in mtd_dump():

- The buffer allocated with malloc(erasesize) is never freed before
  returning, leaking erasesize bytes on every call.
- The pre-existing malloc-NULL early return path also leaked the just-
  opened fd by returning directly instead of going through cleanup.

Initialize buf to NULL, route the malloc-NULL case through the
existing 'out:' label, and add free(buf) on the cleanup path so both
fd and buf are released consistently on every exit.

Signed-off-by: Anna Kiri <bredcorn@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23706
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-06-08 16:18:23 +02:00
..
2013-06-21 16:54:37 +00:00
2013-06-21 16:54:37 +00:00
2025-05-20 00:47:37 +02:00
2025-06-08 12:20:15 +02:00
2025-06-08 12:20:15 +02:00
2016-05-09 18:53:11 +02:00
2016-10-27 01:50:42 +03:00