You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Error-path leak in MQTT protobuf handle_nodes_state() #2905
The normal path releases all node_states[i] entries and the node_states
array. But if an allocation inside the loop fails, the code jumps directly to end:
At that point node_states has already been allocated, and some earlier node_states[i] entries may also have been allocated. The end label only
frees states->states, so the partially-built protobuf array is leaked.
Suggested fix: add a cleanup path for the protobuf branch that frees all
already-created node_states[i] entries and the node_states array before
leaving on allocation failure. It would also be safer to check json_str = malloc(size) before packing into it.
Activity
fengzeroz commentedon Jul 16, 2026
#2908