Small memory management fix: release observer reference when present.

Signed-off-by: Atheriel <atheriel@gmail.com>