fix(python): free allocated string pointers (#393)

* fix(python): free allocated string pointers

* Update python/src/deltachat/cutil.py

Co-Authored-By: holger krekel  <holger@merlinux.eu>

* Update cutil.py

* probably the proper way to handle ffi.strings
This commit is contained in:
Friedel Ziegelmayer
2019-08-18 12:45:38 +02:00
committed by holger krekel
parent 6b2fe03d08
commit 8c10aa287c
3 changed files with 7 additions and 6 deletions

View File

@@ -142,7 +142,7 @@ class Message(object):
import email.parser
mime_headers = lib.dc_get_mime_headers(self._dc_context, self.id)
if mime_headers:
s = ffi.string(mime_headers)
s = ffi.string(ffi.gc(mime_headers, lib.dc_str_unref))
if isinstance(s, bytes):
s = s.decode("ascii")
return email.message_from_string(s)