From 03a03359a1413e6201415d9d3b1b6abd55c2f696 Mon Sep 17 00:00:00 2001 From: void!yura Date: Thu, 17 Feb 2005 18:01:56 +0000 Subject: [PATCH] Fix memleak in ntfs_attr_update_mapping_pairs (Logical change 1.678) --- libntfs/attrib.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index e9e66fa5..a7414dac 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2004 Anton Altaparmakov * Copyright (c) 2002 Richard Russon - * Copyright (c) 2004 Yura Pakhuchiy + * Copyright (c) 2004-2005 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -4293,9 +4293,12 @@ retry: goto put_err_out; } Dprintf("%s(): Deallocate done.\n", __FUNCTION__); + ntfs_attr_put_search_ctx(ctx); return 0; } - + ntfs_attr_put_search_ctx(ctx); + ctx = NULL; + /* Allocate new MFT records for the rest of mapping pairs. */ while (1) { /* Calculate size of rest mapping pairs. */ @@ -4367,7 +4370,8 @@ retry: } return 0; put_err_out: - ntfs_attr_put_search_ctx(ctx); + if (ctx) + ntfs_attr_put_search_ctx(ctx); errno = err; return -1; }