Mercurial > hg
changeset 38305:1445b556e9d2
merge with stable
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 14 Jun 2018 20:09:54 +0900 |
parents | fabfbbf4dee2 (current diff) 6caca2a7d37f (diff) |
children | 523f64466a05 |
files | mercurial/cext/revlog.c tests/test-patch.t |
diffstat | 4 files changed, 11 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/chg/chg.c Wed Jun 13 14:28:39 2018 -0700 +++ b/contrib/chg/chg.c Thu Jun 14 20:09:54 2018 +0900 @@ -220,7 +220,10 @@ const char **argv = mallocx(sizeof(char *) * argsize); memcpy(argv, baseargv, sizeof(baseargv)); - memcpy(argv + baseargvsize, opts->args, sizeof(char *) * opts->argsize); + if (opts->args) { + size_t size = sizeof(char *) * opts->argsize; + memcpy(argv + baseargvsize, opts->args, size); + } argv[argsize - 1] = NULL; if (putenv("CHGINTERNALMARK=") != 0)
--- a/mercurial/cext/bdiff.c Wed Jun 13 14:28:39 2018 -0700 +++ b/mercurial/cext/bdiff.c Thu Jun 14 20:09:54 2018 +0900 @@ -155,12 +155,8 @@ PyEval_RestoreThread(_save); PyBuffer_Release(&ba); PyBuffer_Release(&bb); - if (al) { - free(al); - } - if (bl) { - free(bl); - } + free(al); + free(bl); if (l.next) { bdiff_freehunks(l.next); }
--- a/mercurial/cext/manifest.c Wed Jun 13 14:28:39 2018 -0700 +++ b/mercurial/cext/manifest.c Thu Jun 14 20:09:54 2018 +0900 @@ -185,15 +185,13 @@ { /* free any extra lines we had to allocate */ int i; - for (i = 0; i < self->numlines; i++) { + for (i = 0; self->lines && (i < self->numlines); i++) { if (self->lines[i].from_malloc) { free(self->lines[i].start); } } - if (self->lines) { - free(self->lines); - self->lines = NULL; - } + free(self->lines); + self->lines = NULL; if (self->pydata) { Py_DECREF(self->pydata); self->pydata = NULL;
--- a/mercurial/cext/revlog.c Wed Jun 13 14:28:39 2018 -0700 +++ b/mercurial/cext/revlog.c Thu Jun 14 20:09:54 2018 +0900 @@ -333,10 +333,8 @@ PyMem_Free(self->offsets); self->offsets = NULL; } - if (self->nt) { - free(self->nt); - self->nt = NULL; - } + free(self->nt); + self->nt = NULL; Py_CLEAR(self->headrevs); }