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

[PATCH] Fix an unitialized pointer in merge-recursive.c

From
MCMarco Costalba <mcostalba@gmail.com>
Date
Aug 16, 2007, 08:00 UTC
Message-ID
<e5bfff550708160100t5aa93430x6cbe83e6e7a61d73@mail.gmail.com>

Indeed &mrtree is passed to merge_trees() that not always seems to set the value, so on some paths mrtree could return uninitialized.

Spotted by a gcc 4.2.1 warning
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
---
 merge-recursive.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/merge-recursive.c b/merge-recursive.c
index 16f6a0f..934b0d6 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1610,7 +1610,7 @@ static int merge(struct commit
 {
  	struct commit_list *iter;
  	struct commit *merged_common_ancestors;
-	struct tree *mrtree;
+	struct tree *mrtree = NULL;
 	int clean;

 	if (show(4)) {
-- 
1.5.3.rc4.67.gf9286
Next: Junio C Hamano
Message 1 of 7 in “Fix an unitialized pointer in merge-recursive.c”
  1. Fix an unitialized pointer in merge-recursive.cMarco Costalba, Aug 16, 2007
  2. Junio C HamanoAug 16, 2007
  3. Marco CostalbaAug 16, 2007
  4. Junio C HamanoAug 16, 2007
  5. Junio C HamanoAug 16, 2007
  6. David KastrupAug 16, 2007
  7. Florian WeimerAug 16, 2007

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.