[Liblas-commits] hg: use LASString_Free for cleaning up strings

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Jun 21 14:47:18 EDT 2011


details:   http://hg.liblas.orghg/rev/0bc391995500
changeset: 2969:0bc391995500
user:      Howard Butler <hobu.inc at gmail.com>
date:      Tue Jun 21 13:46:40 2011 -0500
description:
use LASString_Free for cleaning up strings
Subject: hg: we always own the header and should aways free it

details:   http://hg.liblas.orghg/rev/f70806e4d64c
changeset: 2970:f70806e4d64c
user:      Howard Butler <hobu.inc at gmail.com>
date:      Tue Jun 21 13:47:03 2011 -0500
description:
we always own the header and should aways free it

diffstat:

 python/liblas/core.py |  4 +++-
 python/liblas/file.py |  2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diffs (33 lines):

diff -r b181d7145e8b -r f70806e4d64c python/liblas/core.py
--- a/python/liblas/core.py	Tue Jun 21 10:53:54 2011 -0500
+++ b/python/liblas/core.py	Tue Jun 21 13:47:03 2011 -0500
@@ -108,6 +108,7 @@
         raise LASException(msg)
 
     retval = ctypes.string_at(result)[:]
+    
     return retval
 
 
@@ -115,7 +116,8 @@
 
     size = ctypes.c_int()
     retvalue = ctypes.string_at(result)
-    free(result)
+    pdata = ctypes.cast(result, ctypes.POINTER(ctypes.c_char_p))
+    las.LASString_Free(pdata)
     return retvalue
 
 
diff -r b181d7145e8b -r f70806e4d64c python/liblas/file.py
--- a/python/liblas/file.py	Tue Jun 21 10:53:54 2011 -0500
+++ b/python/liblas/file.py	Tue Jun 21 13:47:03 2011 -0500
@@ -218,7 +218,7 @@
                 files['write'].remove(self.filename)
             core.las.LASWriter_Destroy(self.handle)
         
-        if self.ownheader:
+        if (self._header):
             core.las.LASHeader_Destroy(self._header)
             
         self._header = None


More information about the Liblas-commits mailing list