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

[PATCH 1/1] diffcore-break: prevent dangling pointer

From
Han Young <hanyang.tony@bytedance.com>
Date
Feb 11, 2026, 04:11 UTC
Message-ID
<20260211041128.48412-2-hanyang.tony@bytedance.com>
In-Reply-To
<20260211041128.48412-1-hanyang.tony@bytedance.com>
After we have freed the file pair, we should set the queue reference to null.
This prevents us from encountering a dangling pointer later on.
---
 diffcore-break.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/diffcore-break.c b/diffcore-break.c
index c4c2173f30..9b11fe2fa0 100644
--- a/diffcore-break.c
+++ b/diffcore-break.c
@@ -222,6 +222,7 @@ void diffcore_break(struct repository *r, int break_score)
 				free(p); /* not diff_free_filepair(), we are
 					  * reusing one and two here.
 					  */
+				q->queue[i] = NULL;
 				continue;
 			}
 		}
-- 
2.52.0
Previous: Han YoungNext: Junio C Hamano
Message 2 of 11 in “diffcore-break: prevent dangling pointer”
  1. 0/1 diffcore-break: prevent dangling pointerHan Young, Feb 11, 2026
  2. 1/1 diffcore-break: prevent dangling pointerHan Young, Feb 11, 2026
  3. Junio C HamanoFeb 11, 2026
  4. 0/1 diffcore-break: prevent dangling pointerHan Young, Feb 12, 2026
  5. 1/1 diffcore-break: prevent dangling pointerHan Young, Feb 12, 2026
  6. Junio C HamanoFeb 12, 2026
  7. Han YoungFeb 13, 2026
  8. Junio C HamanoFeb 13, 2026
  9. 0/1 diffcore-break: avoid segfault with freed entriesHan Young, Feb 24, 2026
  10. 1/1 diffcore-break: avoid segfault with freed entriesHan Young, Feb 24, 2026
  11. Junio C HamanoFeb 24, 2026

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.