Mettle

M0104Storing a stack address in a global

Reported by the compiler as an error or warning.

mettle explain M0104

A pointer to a stack local is stored in a global variable. Once the function returns the global points at a dead frame.

Fix: store heap memory in globals, or copy the value itself.

Related