Plugs memory leak in fdisk. Very minor fix, but at least makes valgrind happy. Signed-off-by: Petr Uzel <petr.uzel@xxxxxxx> --- fdisk/fdisk.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c index a20a396..4d1b8c0 100644 --- a/fdisk/fdisk.c +++ b/fdisk/fdisk.c @@ -1158,6 +1158,14 @@ static void init_mbr_buffer(void) MBRbuffer = xcalloc(1, MAX_SECTOR_SIZE); } +static void free_mbr_buffer(void) +{ + if (MBRbuffer) { + free(MBRbuffer); + MBRbuffer = NULL; + } +} + void zeroize_mbr_buffer(void) { if (MBRbuffer) @@ -3028,6 +3036,7 @@ main(int argc, char **argv) { #endif init_mbr_buffer(); + atexit(free_mbr_buffer); if (optl) { nowarn = 1; -- 1.7.3.4 -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html