comparison mercurial/bdiff.c @ 4131:1ca664c964e0

don't return uninitialized memory from bdiff.blocks() bdiff.blocks() returns a dummy match at the end of both files; the length of that chunk is never set, so it will sometimes contain random heap garbage. There are apparently workarounds for this elsewhere: # bdiff sometimes gives huge matches past eof, this check eats them,
author Erling Ellingsen <erlingalf@gmail.com>
date Tue, 20 Feb 2007 22:20:16 +0100
parents 8c617d48564a
children 9dc64c8414ca
comparison
equal deleted inserted replaced
4130:178007785be8 4131:1ca664c964e0
249 ((an<bn ? an:bn) + 1)); 249 ((an<bn ? an:bn) + 1));
250 250
251 if (pos && l.base && t) { 251 if (pos && l.base && t) {
252 /* generate the matching block list */ 252 /* generate the matching block list */
253 recurse(a, b, pos, 0, an, 0, bn, &l); 253 recurse(a, b, pos, 0, an, 0, bn, &l);
254 l.head->a1 = an; 254 l.head->a1 = l.head->a2 = an;
255 l.head->b1 = bn; 255 l.head->b1 = l.head->b2 = bn;
256 l.head++; 256 l.head++;
257 } 257 }
258 258
259 free(pos); 259 free(pos);
260 return l; 260 return l;