jcs
/amend
/amendments
/144
diffreg: Re-init static vars in diffreg
context_vec_start is used to calculate other things, so when we
started freeing and nullifying it, subsequent runs used non-zero
values for some of these variables. Reset them all just to be safe.
jcs made amendment 144 over 2 years ago
--- diffreg.c Mon Mar 18 08:47:50 2024
+++ diffreg.c Thu Mar 21 10:45:02 2024
@@ -290,6 +290,15 @@ diffreg(char *file1, char *file2, int flags)
FILE *f1, *f2;
int i, rval;
+ J = class = klist = member = NULL;
+ clen = inifdef = pref = suff = 0;
+ len[0] = len[1] = slen[0] = slen[1] = 0;
+ ixnew = ixold = 0;
+ clist = NULL;
+ clistlen = 0;
+ sfile[0] = sfile[1] = NULL;
+ context_vec_start = context_vec_end = context_vec_ptr = NULL;
+
f1 = f2 = NULL;
rval = D_SAME;
anychange = 0;
@@ -406,6 +415,7 @@ closem:
xfree(&J);
if (context_vec_start)
xfree(&context_vec_start);
+
return (rval);
}