mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-27 13:21:11 +03:00
buffer: Use calloc to allocate a zero'ed buffer
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
@@ -84,12 +84,12 @@ static void buffer_verify(ssh_buffer buf){
|
|||||||
* @return A newly initialized SSH buffer, NULL on error.
|
* @return A newly initialized SSH buffer, NULL on error.
|
||||||
*/
|
*/
|
||||||
struct ssh_buffer_struct *ssh_buffer_new(void) {
|
struct ssh_buffer_struct *ssh_buffer_new(void) {
|
||||||
struct ssh_buffer_struct *buf = malloc(sizeof(struct ssh_buffer_struct));
|
struct ssh_buffer_struct *buf =
|
||||||
|
calloc(1, sizeof(struct ssh_buffer_struct));
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memset(buf, 0, sizeof(struct ssh_buffer_struct));
|
|
||||||
buffer_verify(buf);
|
buffer_verify(buf);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user