mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-09-02 21:27:52 -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
|
void mod2dense_free
|
||||||
( mod2dense *m /* Matrix to free */
|
( mod2dense *m /* Matrix to free */
|
||||||
)
|
)
|
||||||
{ free(m->bits);
|
{ if (m)
|
||||||
free(m->col);
|
{ free(m->bits);
|
||||||
free(m);
|
free(m->col);
|
||||||
|
free(m);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,13 +114,17 @@ void mod2sparse_free
|
|||||||
{
|
{
|
||||||
mod2block *b;
|
mod2block *b;
|
||||||
|
|
||||||
free(m->rows);
|
if (m)
|
||||||
free(m->cols);
|
{ free(m->rows);
|
||||||
|
free(m->cols);
|
||||||
|
|
||||||
while (m->blocks!=0)
|
while (m->blocks!=0)
|
||||||
{ b = m->blocks;
|
{ b = m->blocks;
|
||||||
m->blocks = b->next;
|
m->blocks = b->next;
|
||||||
free(b);
|
free(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
free (m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1186,7 +1190,7 @@ int mod2sparse_decomp
|
|||||||
cc2 = 0;
|
cc2 = 0;
|
||||||
for (j = 0; j<N; j++)
|
for (j = 0; j<N; j++)
|
||||||
{ cc3 = mod2sparse_count_col(B,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;
|
{ if (cc3==k) cc -= 1;
|
||||||
for (;;)
|
for (;;)
|
||||||
{ f = mod2sparse_first_in_col(B,j);
|
{ f = mod2sparse_first_in_col(B,j);
|
||||||
|
@ -199,11 +199,19 @@ garbled:
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fortran interface routine for WSJT-X
|
// Fortran interface routines for WSJT-X
|
||||||
void init_ldpc_ (char *pfile, char *gfile )
|
void init_ldpc_ (char *pfile, char *gfile )
|
||||||
{
|
{
|
||||||
char *pchk_file,*gen_file;
|
|
||||||
read_pchk( pfile );
|
read_pchk( pfile );
|
||||||
read_gen( gfile, 0, 0 );
|
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