Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
7830ae67
Unverified
Commit
7830ae67
authored
Oct 13, 2020
by
Philip Gladstone
Committed by
GitHub
Oct 13, 2020
Browse files
Guard against freeing a ref of zero (#3308)
parent
b9091784
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/modules/gpio_pulse.c
View file @
7830ae67
...
@@ -416,7 +416,9 @@ static int gpio_pulse_start(lua_State *L) {
...
@@ -416,7 +416,9 @@ static int gpio_pulse_start(lua_State *L) {
return
luaL_error
(
L
,
"missing callback"
);
return
luaL_error
(
L
,
"missing callback"
);
}
}
luaL_unref
(
L
,
LUA_REGISTRYINDEX
,
pulser
->
cb_ref
);
if
(
pulser
->
cb_ref
)
{
luaL_unref
(
L
,
LUA_REGISTRYINDEX
,
pulser
->
cb_ref
);
}
pulser
->
cb_ref
=
luaL_ref
(
L
,
LUA_REGISTRYINDEX
);
pulser
->
cb_ref
=
luaL_ref
(
L
,
LUA_REGISTRYINDEX
);
active_pulser
=
pulser
;
active_pulser
=
pulser
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment