Fix memory leak on tmp_buf
authorColin Ian King <colin.king@canonical.com>
Mon, 14 Nov 2016 00:05:37 +0000 (00:05 +0000)
committerColin Ian King <colin.king@canonical.com>
Mon, 14 Nov 2016 00:05:37 +0000 (00:05 +0000)
tmp_buf is allocated but not free'd, causing a minor memory leak

Signed-off-by: Colin Ian King <colin.king@canonical.com>
oslib/libmtd.c

index 5b22d6a8abb453cfd015be3f3f1ea8aef35d4e82..24e9db9cf062da307cd50cc11c17416152efdc73 100644 (file)
@@ -1116,6 +1116,7 @@ static int legacy_auto_oob_layout(const struct mtd_dev_info *mtd, int fd,
                len = mtd->oob_size - start;
                memcpy(oob + start, tmp_buf + start, len);
        }
+       free(tmp_buf);
 
        return 0;
 }