Skip to content

Commit 080c532

Browse files
committed
Fixes #10 - memory leak in arrayOf.
1 parent be82ee5 commit 080c532

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

Data/JsonStream/Parser.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,11 @@ array' valparse = Parser $ \tp ->
237237
(TokFailed) -> Failed "Array - token failed"
238238
where
239239
nextitem _ _ (ArrayEnd ctx) ntok = Done ctx ntok
240-
nextitem i tok _ _ = arrcontent i (callParse (valparse i) tok)
240+
nextitem !i tok _ _ = arrcontent i (callParse (valparse i) tok)
241241

242-
arrcontent i (Done _ ntp) = moreData (nextitem (i+1)) ntp
243-
arrcontent i (MoreData (Parser np, ntp)) = MoreData (Parser (arrcontent i . np), ntp)
244-
arrcontent i (Yield v np) = Yield v (arrcontent i np)
242+
arrcontent !i (Done _ ntp) = moreData (nextitem (i+1)) ntp
243+
arrcontent !i (MoreData (Parser np, ntp)) = MoreData (Parser (arrcontent i . np), ntp)
244+
arrcontent !i (Yield v np) = Yield v (arrcontent i np)
245245
arrcontent _ (Failed err) = Failed err
246246

247247
-- | Match all items of an array.

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 0.4.1.1
2+
Fixed memory leak in arrayOf
3+
14
# 0.4.1.0
25
Added aeson-compatibile encode/decode functions.
36

json-stream.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: json-stream
2-
version: 0.4.1.0
2+
version: 0.4.1.1
33
synopsis: Incremental applicative JSON parser
44
description: Easy to use JSON parser fully supporting incremental parsing.
55
Parsing grammar in applicative form.

0 commit comments

Comments
 (0)