[gnu.utils.bug] Dangling pointers in GNU diff3 version 1.7

graham@ai.mit.edu (11/22/89)

While porting GNU diff3 version 1.7 to MS-DOS, I came across a couple
of places where pointers were not being initialized. I didn't follow the
code close enough to know whether both of the following fixes are
required, but certainly at least one of them is. The bug probably doesn't
show up under UNIX, because space which is mallocated for the first
time, will normally contain 0 anyway.

Doug.
...!uunet!mitel!sce!tsmith!graham

P.S.
	Is it appropriate to post bug reports of this sort to gnu.utils.bug
	on Usenet? I know that other people have attempted to do ports to
	DOS, and information of this sort could be useful to them as well.
	Or do they just have to wait 'till version 1.8 arrives, and try again?

--------------------------------------------------------------------

*** diff3.old	Sat Apr 08 12:56:10 1989
--- diff3.c	Tue Nov 21 05:01:30 1989
***************
*** 806,811 ****
--- 806,812 ----
    struct diff3_block *result = ALLOCATE (1, struct diff3_block);
    int numlines;
  
+   D_NEXT (result) = (struct diff3_block *)0;
    D3_TYPE (result) = ERROR;
  
    /* Assign ranges */
***************
*** 913,918 ****
--- 914,920 ----
    while (scan_diff - diff_contents < diff_size)
      {
        bptr = ALLOCATE (1, struct diff_block);
+       bptr->next = (struct diff_block *)0;
        bptr->lines[0] = bptr->lines[1] = (char **) 0;
        bptr->lengths[0] = bptr->lengths[1] = (int *) 0;