Skip to content

Commit

Permalink
Fix memory leak when using Pin.getInfo on a pin with ADCs (and non-re…
Browse files Browse the repository at this point in the history
…porting of analogs)
  • Loading branch information
gfwilliams committed Jul 3, 2024
1 parent 28b175a commit eacd006
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Bangle.js2: After Bangle.showTestScreen, put Bangle.js into a hard off state (not soft off)
Fix for unexpected power draw on newest batch of Bangle.js devices
Puck.js: skip CRT startup code to save ~300b
Fix memory leak when using Pin.getInfo on a pin with ADCs (and non-reporting of analogs)

2v23 : Fix XON/OFF thresholds to be based off the correct buffer size
Bangle.js2: Added BANGLE2_IFLASH target for firmware using internal flash for js files (currently only partially working)
Expand Down
4 changes: 3 additions & 1 deletion src/jswrap_pin.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,9 @@ JsVar *jswrap_pin_getInfo(
jsvArrayPushAndUnLock(arr, jsvNewFromInteger(1+i));
jsvObjectSetChildAndUnLock(an, "ADCs", arr);
}
jsvObjectSetChildAndUnLock(obj, "channel", jsvNewFromInteger(inf->analog & JSH_MASK_ANALOG_CH));
jsvObjectSetChildAndUnLock(an, "channel", jsvNewFromInteger(inf->analog & JSH_MASK_ANALOG_CH));
jsvObjectSetChildAndUnLock(obj, "channel", jsvNewFromInteger(inf->analog & JSH_MASK_ANALOG_CH)); // for backwards compatibility with 2v22 and earlier
jsvObjectSetChildAndUnLock(obj, "analog", an);
}
}
JsVar *funcs = jsvNewObject();
Expand Down

0 comments on commit eacd006

Please sign in to comment.