Allocate 1024 bytes on the stack instead of using calloc
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
nread -= headersize;
if (nread < smb_maxcnt) {
- char *buf = SMB_CALLOC_ARRAY(char, SHORT_SEND_BUFSIZE);
- if (!buf) {
- DEBUG(0,("sendfile_short_send: malloc failed "
- "for file %s (%s). Terminating\n",
- fsp_str_dbg(fsp), strerror(errno)));
- return -1;
- }
+ char buf[SHORT_SEND_BUFSIZE] = { 0 };
DEBUG(0,("sendfile_short_send: filling truncated file %s "
"with zeros !\n", fsp_str_dbg(fsp)));
}
nread += to_write;
}
- SAFE_FREE(buf);
}
return 0;