bug-patch
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-patch] [PATCH] plug a leak


From: Jim Meyering
Subject: [bug-patch] [PATCH] plug a leak
Date: Tue, 24 May 2011 12:02:02 +0200

I ran coverity against patch and it reported this legitimate leak.
It was even triggered by the 'merge" test.
Here's the fix:

>From bc8a1013dfbdbb8fb103ba855283d2f22358e995 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 24 May 2011 11:47:25 +0200
Subject: [PATCH] plug a leak

* src/bestmatch.h (bestmatch): Don't leak V when returning early.
---
 src/bestmatch.h |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/bestmatch.h b/src/bestmatch.h
index 958b1ca..a162bb5 100644
--- a/src/bestmatch.h
+++ b/src/bestmatch.h
@@ -89,7 +89,10 @@ bestmatch(OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim,
        fmid_plus_2_min = fmid + 2 * min;
        min += yoff;
        if (min > ylim)
-         return max + 1;
+         {
+           free (V);
+           return max + 1;
+         }
       }
     else
       fmid_plus_2_min = 0;  /* disable this check */
--
1.7.5.2.585.gfbd48



reply via email to

[Prev in Thread] Current Thread [Next in Thread]