mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-09-02 13:17:49 -04:00
Fix some defects in the LDPC mod2 matrix free routines
Add a function to free heap allocations made reading in the LDPC parity check and generator matrices. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6763 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
c58876507b
commit
c5c3d14689
@ -65,9 +65,11 @@ mod2dense *mod2dense_allocate
|
||||
void mod2dense_free
|
||||
( mod2dense *m /* Matrix to free */
|
||||
)
|
||||
{ free(m->bits);
|
||||
free(m->col);
|
||||
free(m);
|
||||
{ if (m)
|
||||
{ free(m->bits);
|
||||
free(m->col);
|
||||
free(m);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -114,13 +114,17 @@ void mod2sparse_free
|
||||
{
|
||||
mod2block *b;
|
||||
|
||||
free(m->rows);
|
||||
free(m->cols);
|
||||
if (m)
|
||||
{ free(m->rows);
|
||||
free(m->cols);
|
||||
|
||||
while (m->blocks!=0)
|
||||
{ b = m->blocks;
|
||||
m->blocks = b->next;
|
||||
free(b);
|
||||
while (m->blocks!=0)
|
||||
{ b = m->blocks;
|
||||
m->blocks = b->next;
|
||||
free(b);
|
||||
}
|
||||
|
||||
free (m);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1186,7 +1190,7 @@ int mod2sparse_decomp
|
||||
cc2 = 0;
|
||||
for (j = 0; j<N; j++)
|
||||
{ cc3 = mod2sparse_count_col(B,j);
|
||||
if (cc3>k || cc3==k && cc>0)
|
||||
if (cc3>k || (cc3==k && cc>0))
|
||||
{ if (cc3==k) cc -= 1;
|
||||
for (;;)
|
||||
{ f = mod2sparse_first_in_col(B,j);
|
||||
|
@ -199,11 +199,19 @@ garbled:
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Fortran interface routine for WSJT-X
|
||||
// Fortran interface routines for WSJT-X
|
||||
void init_ldpc_ (char *pfile, char *gfile )
|
||||
{
|
||||
char *pchk_file,*gen_file;
|
||||
read_pchk( pfile );
|
||||
read_gen( gfile, 0, 0 );
|
||||
}
|
||||
|
||||
void fini_ldpc_ ()
|
||||
{
|
||||
mod2dense_free (G);
|
||||
mod2sparse_free (U);
|
||||
mod2sparse_free (L);
|
||||
free (cols);
|
||||
free (rows);
|
||||
mod2sparse_free (H);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user