(load_panelize): replace while() by for() and fix potential memory leak.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>