##// END OF EJS Templates
bdiff: avoid a memory error on malloc failure
Matt Mackall -
r19962:66b21ce6 stable
parent child Browse files
Show More
@@ -303,6 +303,8 b' static PyObject *blocks(PyObject *self, '
303 struct hunk l, *h;
303 struct hunk l, *h;
304 int an, bn, count, pos = 0;
304 int an, bn, count, pos = 0;
305
305
306 l.next = NULL;
307
306 if (!PyArg_ParseTuple(args, "SS:bdiff", &sa, &sb))
308 if (!PyArg_ParseTuple(args, "SS:bdiff", &sa, &sb))
307 return NULL;
309 return NULL;
308
310
@@ -312,7 +314,6 b' static PyObject *blocks(PyObject *self, '
312 if (!a || !b)
314 if (!a || !b)
313 goto nomem;
315 goto nomem;
314
316
315 l.next = NULL;
316 count = diff(a, an, b, bn, &l);
317 count = diff(a, an, b, bn, &l);
317 if (count < 0)
318 if (count < 0)
318 goto nomem;
319 goto nomem;
@@ -344,6 +345,8 b' static PyObject *bdiff(PyObject *self, P'
344 Py_ssize_t len = 0, la, lb;
345 Py_ssize_t len = 0, la, lb;
345 PyThreadState *_save;
346 PyThreadState *_save;
346
347
348 l.next = NULL;
349
347 if (!PyArg_ParseTuple(args, "s#s#:bdiff", &sa, &la, &sb, &lb))
350 if (!PyArg_ParseTuple(args, "s#s#:bdiff", &sa, &la, &sb, &lb))
348 return NULL;
351 return NULL;
349
352
@@ -358,7 +361,6 b' static PyObject *bdiff(PyObject *self, P'
358 if (!al || !bl)
361 if (!al || !bl)
359 goto nomem;
362 goto nomem;
360
363
361 l.next = NULL;
362 count = diff(al, an, bl, bn, &l);
364 count = diff(al, an, bl, bn, &l);
363 if (count < 0)
365 if (count < 0)
364 goto nomem;
366 goto nomem;
General Comments 0
You need to be logged in to leave comments. Login now