Mercurial > hg
changeset 19962:66b21ce60a19 stable
bdiff: avoid a memory error on malloc failure
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 30 Oct 2013 16:03:42 -0500 |
parents | 1d7a36ff2615 |
children | 6f29cc567845 |
files | mercurial/bdiff.c |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/bdiff.c Wed Oct 23 13:12:48 2013 -0700 +++ b/mercurial/bdiff.c Wed Oct 30 16:03:42 2013 -0500 @@ -303,6 +303,8 @@ struct hunk l, *h; int an, bn, count, pos = 0; + l.next = NULL; + if (!PyArg_ParseTuple(args, "SS:bdiff", &sa, &sb)) return NULL; @@ -312,7 +314,6 @@ if (!a || !b) goto nomem; - l.next = NULL; count = diff(a, an, b, bn, &l); if (count < 0) goto nomem; @@ -344,6 +345,8 @@ Py_ssize_t len = 0, la, lb; PyThreadState *_save; + l.next = NULL; + if (!PyArg_ParseTuple(args, "s#s#:bdiff", &sa, &la, &sb, &lb)) return NULL; @@ -358,7 +361,6 @@ if (!al || !bl) goto nomem; - l.next = NULL; count = diff(al, an, bl, bn, &l); if (count < 0) goto nomem;