masks: fix another potential memory leak