module: fix double free bug

Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>