Added check after malloc

* src/rmatio.c (write_strsxp): Added check of buf after malloc

* src/rmatio.c (write_struct): Added check of fieldnames after malloc

* src/rmatio.c (read_mat_char): Added check of buf after malloc

* src/rmatio.c (read_structure_array_with_fields): Added check of buf
  after malloc