diff options
author | Alexander Foremny <aforemny@posteo.de> | 2023-12-13 14:13:55 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2023-12-13 14:13:55 +0100 |
commit | ce31c7edc5c3f34464b0dacff7de7e412e3dc6f2 (patch) | |
tree | 2a588492f40517a532cb5641f302bd21c97cd869 | |
parent | fd99b68647163d688ee7322f21882515ef1ed814 (diff) |
chore: free allocated memory in comments
-rw-r--r-- | app/Comment.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/Comment.hs b/app/Comment.hs index c834509..7bd4ad5 100644 --- a/app/Comment.hs +++ b/app/Comment.hs @@ -24,7 +24,7 @@ import Data.Text qualified as T import Data.Text.Encoding qualified as T import Exception qualified as E import Foreign.C.String -import Foreign.Marshal.Alloc (malloc) +import Foreign.Marshal.Alloc (free, malloc) import Foreign.Marshal.Array (mallocArray, peekArray) import Foreign.Ptr (nullPtr) import Foreign.Storable @@ -137,7 +137,10 @@ childNodesFromNode n = do tsNode <- malloc poke tsNode (S.nodeTSNode n) S.ts_node_copy_child_nodes tsNode ns - peekArray numChildren ns + free tsNode + ns' <- peekArray numChildren ns + free ns + pure ns' data CommentStyle = LineStyle T.Text |