bug-patch
[Top][All Lists]
Advanced

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

Re: [bug-patch] [PATCH] plug a leak


From: Andreas Gruenbacher
Subject: Re: [bug-patch] [PATCH] plug a leak
Date: Wed, 25 May 2011 14:36:07 +0200
User-agent: KMail/1.12.4 (Linux/2.6.36-rc7+; KDE/4.3.5; i686; ; )

Jim,

On Tuesday 24 May 2011 12:02:02 Jim Meyering wrote:
> I ran coverity against patch and it reported this legitimate leak.
> It was even triggered by the 'merge" test.

looks correct, but can we use the existing exit path in this function, like 
this?

diff --git a/src/bestmatch.h b/src/bestmatch.h
index 958b1ca..e49f7b4 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;
+         {
+           c = max + 1;
+           goto done;
+         }
       }
     else
       fmid_plus_2_min = 0;  /* disable this check */
-- 

Andreas



reply via email to

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