From 7275b8e8b1134c85d6f4b694ad6f515b3a6dace9 Mon Sep 17 00:00:00 2001 From: Bryan Forbes Date: Tue, 13 Apr 2010 17:12:50 -0500 Subject: Use stdlib.free and plist.plist_free. --- cython/afc.pxi | 14 +++++++------- cython/file_relay.pxi | 2 +- cython/imobiledevice.pyx | 6 +++--- cython/lockdown.pxi | 8 ++++---- cython/property_list_client.pxi | 2 +- cython/sbservices.pxi | 9 +++------ 6 files changed, 19 insertions(+), 22 deletions(-) diff --git a/cython/afc.pxi b/cython/afc.pxi index 398ea39..9200067 100644 --- a/cython/afc.pxi +++ b/cython/afc.pxi @@ -142,7 +142,7 @@ cdef class AfcFile(Base): except BaseError, e: raise finally: - free(c_data) + stdlib.free(c_data) return bytes_written @@ -186,9 +186,9 @@ cdef class AfcClient(BaseService): while infos[i]: info = infos[i] result.append(info) - free(infos[i]) + stdlib.free(infos[i]) i = i + 1 - free(infos) + stdlib.free(infos) return result @@ -209,9 +209,9 @@ cdef class AfcClient(BaseService): while dir_list[i]: f = dir_list[i] result.append(f) - free(dir_list[i]) + stdlib.free(dir_list[i]) i = i + 1 - free(dir_list) + stdlib.free(dir_list) return result @@ -258,9 +258,9 @@ cdef class AfcClient(BaseService): while c_result[i]: info = c_result[i] result.append(info) - free(c_result[i]) + stdlib.free(c_result[i]) i = i + 1 - free(c_result) + stdlib.free(c_result) return result diff --git a/cython/file_relay.pxi b/cython/file_relay.pxi index db9932a..fd7b67e 100644 --- a/cython/file_relay.pxi +++ b/cython/file_relay.pxi @@ -62,7 +62,7 @@ cdef class FileRelayClient(PropertyListService): c_sources[count] = NULL err = file_relay_request_sources(self._c_client, c_sources, &conn._c_connection) - free(c_sources) + stdlib.free(c_sources) self.handle_error(err) return conn diff --git a/cython/imobiledevice.pyx b/cython/imobiledevice.pyx index 77a7a3a..bde43d0 100644 --- a/cython/imobiledevice.pyx +++ b/cython/imobiledevice.pyx @@ -172,8 +172,8 @@ cdef class iDevice(Base): cdef extern from *: ctypedef char* const_char_ptr "const char*" - void free(void *ptr) - void plist_free(plist.plist_t node) + +cimport stdlib cdef class BaseService(Base): __service_name__ = None @@ -191,7 +191,7 @@ cdef class PropertyListService(BaseService): self.handle_error(err) except BaseError, e: if c_node != NULL: - plist_free(c_node) + plist.plist_free(c_node) raise return plist.plist_t_to_node(c_node) diff --git a/cython/lockdown.pxi b/cython/lockdown.pxi index 76f84b1..f8955e5 100644 --- a/cython/lockdown.pxi +++ b/cython/lockdown.pxi @@ -122,7 +122,7 @@ cdef class LockdownClient(PropertyListService): finally: if c_type != NULL: result = c_type - free(c_type) + stdlib.free(c_type) return result @@ -141,7 +141,7 @@ cdef class LockdownClient(PropertyListService): self.handle_error(err) except BaseError, e: if c_node != NULL: - plist_free(c_node) + plist.plist_free(c_node) raise return plist.plist_t_to_node(c_node) @@ -154,7 +154,7 @@ cdef class LockdownClient(PropertyListService): raise finally: if c_node != NULL: - plist_free(c_node) + plist.plist_free(c_node) cpdef remove_value(self, bytes domain, bytes key): self.handle_error(lockdownd_remove_value(self._c_client, domain, key)) @@ -207,7 +207,7 @@ cdef class LockdownClient(PropertyListService): finally: if c_session_id != NULL: session_id = c_session_id - free(c_session_id) + stdlib.free(c_session_id) return (session_id, ssl_enabled) diff --git a/cython/property_list_client.pxi b/cython/property_list_client.pxi index c137b34..718b07f 100644 --- a/cython/property_list_client.pxi +++ b/cython/property_list_client.pxi @@ -11,7 +11,7 @@ cdef class PropertyListClient(Base): self.handle_error(err) except BaseError, e: if c_node != NULL: - plist_free(c_node) + plist.plist_free(c_node) raise return plist.plist_t_to_node(c_node) diff --git a/cython/sbservices.pxi b/cython/sbservices.pxi index 28aa5a5..13a49aa 100644 --- a/cython/sbservices.pxi +++ b/cython/sbservices.pxi @@ -52,7 +52,7 @@ cdef class SpringboardServicesClient(Base): self.handle_error(err) except BaseError, e: if c_node != NULL: - plist_free(c_node) + plist.plist_free(c_node) raise return plist.plist_t_to_node(c_node) def __set__(self, plist.Node newstate not None): @@ -60,7 +60,6 @@ cdef class SpringboardServicesClient(Base): cpdef bytes get_pngdata(self, bytes bundleId): cdef: - bytes result char* pngdata = NULL uint64_t pngsize sbservices_error_t err @@ -68,8 +67,6 @@ cdef class SpringboardServicesClient(Base): try: self.handle_error(err) except BaseError, e: + stdlib.free(pngdata) raise - finally: - result = pngdata[:pngsize] - free(pngdata) - return result + return pngdata[:pngsize] -- cgit v1.1-32-gdbae