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

[PATCH 2/2] builtin-tag: fix uninitialized variables

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 20, 2007, 12:07 UTC
Message-ID
<Pine.LNX.4.64.0707201306340.14781@racer.site>

The function launch_editor() expects the variables 'buffer' and 'size' to be initialized, either to an existing buffer, or to NULL and 0.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
	This is only called 2/2, because I found this error by testing 
	1/2...
 builtin-tag.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin-tag.c b/builtin-tag.c
index cf36def..81d37ce 100644
--- a/builtin-tag.c
+++ b/builtin-tag.c
@@ -253,9 +253,9 @@ static void create_tag(const unsigned char *object, const char *tag,
 		       char *message, int sign, unsigned char *result)
 {
 	enum object_type type;
-	char header_buf[1024], *buffer;
+	char header_buf[1024], *buffer = NULL;
 	int header_len, max_size;
-	unsigned long size;
+	unsigned long size = 0;
 
 	type = sha1_object_info(object, NULL);
 	if (type <= 0)
-- 
1.5.3.rc1.16.g9d6f-dirty
Message 1 of 1 in “builtin-tag: fix uninitialized variables”
  1. 2/2 builtin-tag: fix uninitialized variablesJohannes Schindelin, Jul 20, 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.