Patchwork [5,of,7] parsers: don't leak a tuple in pack_dirstate

login
register
mail settings
Submitter Augie Fackler
Date Jan. 23, 2015, 9:06 p.m.
Message ID <b6e21fb810731af06f96.1422047202@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/7543/
State Accepted
Commit f3e94aa6e1823f83fd6a099cf3a2f2b77a4e26b2
Headers show

Comments

Augie Fackler - Jan. 23, 2015, 9:06 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1422046098 18000
#      Fri Jan 23 15:48:18 2015 -0500
# Branch stable
# Node ID b6e21fb810731af06f96f0e0315cfb0c47906735
# Parent  42f1449f31b50b60109570b6203b5b330817d123
parsers: don't leak a tuple in pack_dirstate

Spotted with cpychecker.

Patch

diff --git a/mercurial/parsers.c b/mercurial/parsers.c
--- a/mercurial/parsers.c
+++ b/mercurial/parsers.c
@@ -410,7 +410,7 @@  static PyObject *pack_dirstate(PyObject 
 	PyObject *packobj = NULL;
 	PyObject *map, *copymap, *pl, *mtime_unset = NULL;
 	Py_ssize_t nbytes, pos, l;
-	PyObject *k, *v, *pn;
+	PyObject *k, *v = NULL, *pn;
 	char *p, *s;
 	double now;
 
@@ -527,6 +527,7 @@  static PyObject *pack_dirstate(PyObject 
 bail:
 	Py_XDECREF(mtime_unset);
 	Py_XDECREF(packobj);
+	Py_XDECREF(v);
 	return NULL;
 }