Checkpoint in valgrind work

This commit is contained in:
Landon Curt Noll
2021-11-27 00:05:28 -08:00
parent fde724aa2d
commit f4d754b47d
9 changed files with 24 additions and 2 deletions

View File

@@ -22,6 +22,10 @@ The following are the changes from calc version 2.14.0.9 to date:
Makefile checks if ${hardware} is arm64 and adjusts the location
of libraries such as readline and history accordingly.
Pluged a number of memory leaks.
Fixed a few cases where v_subtype was not properly initialuzed.
The following are the changes from calc version 2.14.0.7 to 2.14.0.8:

View File

@@ -1 +1,2 @@
# Add below to override Makefile values (using :=) as in: HAVE_STRING_H:= YES
DEBUG= -O0 -g

5
func.c
View File

@@ -1298,6 +1298,7 @@ f_digit(int count, VALUE **vals)
base = _ten_;
}
res.v_type = V_NUM;
res.v_subtype = V_NOSUBTYPE;
res.v_num = qdigit(vals[0]->v_num, vals[1]->v_num->num, base);
if (res.v_num == NULL)
return error_value(E_DGT3);
@@ -1323,6 +1324,7 @@ f_digits(int count, VALUE **vals)
base = _ten_;
}
res.v_type = V_NUM;
res.v_subtype = V_NOSUBTYPE;
res.v_num = itoq(qdigits(vals[0]->v_num, base));
return res;
}
@@ -1346,6 +1348,7 @@ f_places(int count, VALUE **vals)
places = qdecplaces(vals[0]->v_num);
res.v_type = V_NUM;
res.v_subtype = V_NOSUBTYPE;
res.v_num = itoq(places);
return res;
}
@@ -3606,6 +3609,7 @@ f_comb(VALUE *v1, VALUE *v2)
copyvalue(v1, &result);
decvalue(v1, &tmp1);
div.v_type = V_NUM;
div.v_subtype = V_NOSUBTYPE;
div.v_num = qlink(&_qtwo_);
n--;
for (;;) {
@@ -9039,6 +9043,7 @@ f_sleep(int count, VALUE **vals)
NUMBER *q1, *q2;
res.v_type = V_NULL;
res.v_subtype = V_NOSUBTYPE;
#if !defined(_WIN32)
if (count > 0) {
if (vals[0]->v_type != V_NUM || qisneg(vals[0]->v_num))

View File

@@ -161,7 +161,7 @@ removelistfirst(LIST *lp, VALUE *vp)
}
*vp = lp->l_first->e_value;
lp->l_first->e_value.v_type = V_NULL;
lp->l_first->e_value.v_type = V_NOSUBTYPE;
lp->l_first->e_value.v_subtype = V_NOSUBTYPE;
removelistelement(lp, lp->l_first);
}

View File

@@ -927,6 +927,7 @@ matindices(MATRIX *mp, long index)
lp = listalloc();
val.v_type = V_NUM;
val.v_subtype = V_NOSUBTYPE;
j = mp->m_dim;
while (--j >= 0) {
@@ -1068,6 +1069,7 @@ matident(MATRIX *m)
for (row = 0; row < rows; row++) {
for (col = 0; col < rows; col++) {
val->v_type = V_NUM;
val->v_subtype = V_NOSUBTYPE;
val->v_num = ((row == col) ? qlink(&_qone_) :
qlink(&_qzero_));
val++;
@@ -1126,6 +1128,7 @@ matinv(MATRIX *m)
else
val->v_num = qlink(&_qzero_);
val->v_type = V_NUM;
val->v_subtype = V_NOSUBTYPE;
val++;
}
}

View File

@@ -683,6 +683,7 @@ qdigit(NUMBER *q, ZVALUE dpos, ZVALUE base)
return qlink(&_qzero_);
k = zfacrem(q->num, base, &N);
if (k == 0) {
zfree(N);
k = zgcdrem(q->den, base, &D);
if (k > 0) {
zequo(q->den, D, &A);

View File

@@ -1129,6 +1129,7 @@ qln(NUMBER *q, NUMBER *epsilon)
sum.sign = neg;
if (k + n >= m) {
zshift(sum, n - m, &qtmp->num);
zfree(sum);
} else {
if (k) {
zshift(sum, -k, &qtmp->num);

1
seed.c
View File

@@ -373,6 +373,7 @@ pseudo_seed(void)
* We do care (that much) if these calls fail. We do not
* need to process any data in the 'sdata' structure.
*/
memset(&sdata, 0, sizeof(sdata));
#if defined(HAVE_GETTIME)
# if defined(CLOCK_SGI_CYCLE)
(void) clock_gettime(CLOCK_SGI_CYCLE, &sdata.sgi_cycle);

View File

@@ -1439,6 +1439,8 @@ zlog10(ZVALUE z, BOOL *was_10_power)
if (was_10_power != NULL) {
*was_10_power = TRUE;
}
zfree(pow10);
zfree(temp);
return power;
/* ignore this entry if we went too large */
@@ -1452,6 +1454,7 @@ zlog10(ZVALUE z, BOOL *was_10_power)
pow10 = temp;
}
}
zfree(pow10);
return power;
}
@@ -1647,8 +1650,10 @@ zgcdrem(ZVALUE z1, ZVALUE z2, ZVALUE *res)
}
zgcd(z1, z2, &tmp1);
if (zisunit(tmp1) || ziszero(tmp1))
if (zisunit(tmp1) || ziszero(tmp1)) {
zfree(tmp1);
return 0;
}
zequo(z1, tmp1, &tmp2);
count = 1;
z1 = tmp2;
@@ -1668,6 +1673,7 @@ zgcdrem(ZVALUE z1, ZVALUE z2, ZVALUE *res)
zfree(z2);
z2 = tmp1;
}
zfree(z2);
*res = z1;
return count;
}