I often catch myself doing the following (in non-critical components):
some_small_struct *ptr=(some_small_struct *) malloc(sizeof(some_small_struct)); ptr-&g
at the very least I would put an assert(ptr != NULL) in there so you get a meaningful error.
assert(ptr != NULL)