~aakhtar/siesta/spglib-inclusion

« back to all changes in this revision

Viewing changes to Src/m_ts_electype.F90

  • Committer: Nick Papior
  • Date: 2017-02-20 08:46:20 UTC
  • mto: (462.93.1 4.1-md-supercell)
  • mto: This revision was merged to the branch mainline in revision 469.
  • Revision ID: nickpapior@gmail.com-20170220084620-miqdc1i2lgrzqzax
Fixed memory leaks in fdict, and transiesta related routines

Several memory leaks was detected using valgrind, nearly all
have been fixed.

Currently, there is still a memory leak regarding the dictionary
when concatenating. However, it is 2 bytes. I will amend a fix for this
in a later revision (track fdict on github for when the fix will be
available).

Show diffs side-by-side

added added

removed removed

Lines of Context:
195
195
       if ( fdf_bnnames(pline) == 0 ) cycle
196
196
       n = n + 1 
197
197
    end do
 
198
    
 
199
    ! If there are no electrodes, return immediately
 
200
    ! This will signal a new read, or default values of the
 
201
    ! electrodes
 
202
    if ( n == 0 ) return
198
203
 
199
204
    allocate(this_n(n))
200
205
 
1670
1675
  subroutine delete_(this)
1671
1676
    type(Elec), intent(inout) :: this
1672
1677
 
 
1678
    ! Full matrices
1673
1679
    call delete(this%H)
1674
1680
    call delete(this%S)
 
1681
    call delete(this%sp)
 
1682
 
 
1683
    ! 00 matrices
1675
1684
    call delete(this%H00)
 
1685
    call delete(this%S00)
 
1686
    call delete(this%sp00)
 
1687
 
 
1688
    ! 01 matrices
1676
1689
    call delete(this%H01)
1677
 
    call delete(this%S00)
1678
1690
    call delete(this%S01)
1679
 
    call delete(this%sp00)
1680
1691
    call delete(this%sp01)
1681
 
    call delete(this%sp)
 
1692
 
1682
1693
    if ( associated(this%xa) ) deallocate(this%xa)
1683
1694
    if ( associated(this%lasto) ) deallocate(this%lasto)
1684
1695
    nullify(this%xa,this%lasto)
 
1696
    if ( associated(this%isc_off) ) deallocate(this%isc_off)
1685
1697
    !if ( associated(this%xa_used) ) deallocate(this%xa_used)
1686
1698
    !if ( associated(this%lasto_used) ) deallocate(this%lasto_used)
1687
1699
    !nullify(this%xa_used,this%lasto_used)