git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: y.a. static code analysis

From
Alex Riesen <raa.lkml@gmail.com>
Date
May 24, 2009, 13:16 UTC
Message-ID
<20090524131648.GA22800@blimp.localdomain>
In-Reply-To
<81b0412b0905240604q3c8c798bi6ad64d8916b4cd9e@mail.gmail.com>
Noticed and reported by Serhat Şevki Dinçer.
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
Alex Riesen, Sun, May 24, 2009 15:04:06 +0200:
Show 6 quoted lines
> 2009/5/23 Serhat Şevki Dinçer <jfcgauss@gmail.com>:
> 
> > [./http-push.c:1419]: (error) Using 'lock' after it is deallocated / released
> 
> This is the only real bug.
> 
Here's a fix.
 http-push.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/http-push.c b/http-push.c
index dac2c6e..45e8a69 100644
--- a/http-push.c
+++ b/http-push.c
@@ -1415,8 +1415,9 @@ static void remove_locks(void)
 
 	fprintf(stderr, "Removing remote locks...\n");
 	while (lock) {
+		struct remote_lock *next = lock->next;
 		unlock_remote(lock);
-		lock = lock->next;
+		lock = next;
 	}
 }
 
-- 
1.6.3.1.93.g316b2
Previous: Alex RiesenNext: Clemens Buchacher
Message 3 of 4 in “y.a. static code analysis”
  1. Serhat Şevki DinçerMay 23, 2009
  2. Alex RiesenMay 24, 2009
  3. Alex RiesenMay 24, 2009
  4. Clemens BuchacherMay 24, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.