Skip to content

Commit 59b9c40

Browse files
committed
fix: regression: avoid null pointer dereference in CleanDollarFactors
This function can be called with nfactors = 1, but with no array allocated on d->factors.
1 parent c6f4a40 commit 59b9c40

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

sources/dollar.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3556,8 +3556,9 @@ void CleanDollarFactors(DOLLARS d)
35563556
int i;
35573557
if ( d->nfactors >= 1 ) {
35583558
for ( i = 0; i < d->nfactors; i++ ) {
3559-
if ( d->factors[i].where )
3560-
M_free(d->factors[i].where,"dollar factors");
3559+
if ( d->factors )
3560+
if ( d->factors[i].where )
3561+
M_free(d->factors[i].where,"dollar factors");
35613562
}
35623563
}
35633564
if ( d->factors ) {

0 commit comments

Comments
 (0)