Skip to content
Snippets Groups Projects
Commit 66b21ce6 authored by Matt Mackall's avatar Matt Mackall
Browse files

bdiff: avoid a memory error on malloc failure

parent 1d7a36ff
Branches
Tags
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment