On 07/10/2012 05:02 PM, levin li wrote: > out: > if (fd > 0) > close(fd); > return buf; > +err: > + free(buf); > + close(fd); > + return NULL; This is better to reorder as: in err: free(buf); buf = NULL; goto out_close; .... out_close: close(fd); out: return buf; Thanks, Yuan