Update session.c

Fix a potential memory leak.