diff options
Diffstat (limited to 'app/Comment.hs')
-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 |