Skip to content

Commit b70c16e

Browse files
jannicthejpster
authored andcommitted
Don't set _IS_INIT = true before initializing _ALGO_INSTANCE
I hope I don't miss any subtle detail, but it looks wrong to set _IS_INIT before _ALGO_INSTANCE gets initialized. In case new returns Err, _ALGO_INSTANCE will stay uninitialized, but a later call to UnInit will still try to drop it. As there is already a _IS_INIT = true immediately after setting _ALGO_INSTANCE, I think this line can just be removed.
1 parent 529be40 commit b70c16e

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

src/algo.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ macro_rules! algo {
4444
if _IS_INIT {
4545
UnInit();
4646
}
47-
_IS_INIT = true;
4847
match <$type as FlashAlgo>::new(addr, clock, function) {
4948
Ok(inst) => {
5049
_ALGO_INSTANCE.as_mut_ptr().write(inst);

0 commit comments

Comments
 (0)