Add NULL check after malloc() in fortranobject.c

In fortranobject.c there was a `malloc()` without a `NULL` check on the returned pointer.