[PATCH] parsers: fix uninitialize variable warning

David Soria Parra davidsp at fb.com
Wed Sep 24 15:20:48 CDT 2014


# HG changeset patch
# User David Soria Parra <davidsp at fb.com>
# Date 1411589780 25200
#      Wed Sep 24 13:16:20 2014 -0700
# Node ID 2ac6c99d87db382c8757063f15baa235881a38dd
# Parent  12c0a6a7307c938daa8fcfe330a5b35a389c79be
parsers: fix uninitialize variable warning

The heads pointer is not initialized correctly if filter is false, causing
both clang and gcc to issue a warning. Correctly initialize heads to NULL.

diff --git a/mercurial/parsers.c b/mercurial/parsers.c
--- a/mercurial/parsers.c
+++ b/mercurial/parsers.c
@@ -854,7 +854,7 @@
 {
 	Py_ssize_t i, len, addlen;
 	char *nothead = NULL;
-	PyObject *heads;
+	PyObject *heads = NULL;
 	PyObject *filter = NULL;
 	PyObject *filteredrevs = Py_None;
 


More information about the Mercurial-devel mailing list