rilmodem: Fix for memory leaks

This change fixes memory leaks returned by valgrind.