static int io_close_ocb (resmgr_context_t *ctp, void *reserved, RESMGR_OCB_T *ocb) { if (ocb -> output) { free (ocb -> output); ocb -> output = NULL; } return (iofunc_close_ocb_default (ctp, reserved, &ocb -> base)); }
The io_close_ocb() function doesn't do anything special, apart from releasing the memory that may have been allocated in io_read(). The check to see if anything is present in the output member of the extended OCB structure is necessary because it's entirely possible that io_read() was never called and that member never had anything allocated to it (as would be the case with a simple stat() call—stat() doesn't cause read() to be called, so our io_read() would never get called).