mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 09:54:25 +09:00
misc: Reformat allocation checks
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Norbert Pocs <npocs@redhat.com>
This commit is contained in:
@@ -182,7 +182,7 @@ char *ssh_get_local_username(void)
|
|||||||
/* get the size */
|
/* get the size */
|
||||||
GetUserName(NULL, &size);
|
GetUserName(NULL, &size);
|
||||||
|
|
||||||
user = (char *) malloc(size);
|
user = (char *)malloc(size);
|
||||||
if (user == NULL) {
|
if (user == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -674,8 +674,9 @@ const char *ssh_version(int req_version)
|
|||||||
struct ssh_list *ssh_list_new(void)
|
struct ssh_list *ssh_list_new(void)
|
||||||
{
|
{
|
||||||
struct ssh_list *ret = malloc(sizeof(struct ssh_list));
|
struct ssh_list *ret = malloc(sizeof(struct ssh_list));
|
||||||
if (!ret)
|
if (ret == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
ret->root = ret->end = NULL;
|
ret->root = ret->end = NULL;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -734,8 +735,9 @@ static struct ssh_iterator *ssh_iterator_new(const void *data)
|
|||||||
{
|
{
|
||||||
struct ssh_iterator *iterator = malloc(sizeof(struct ssh_iterator));
|
struct ssh_iterator *iterator = malloc(sizeof(struct ssh_iterator));
|
||||||
|
|
||||||
if (!iterator)
|
if (iterator == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
iterator->next = NULL;
|
iterator->next = NULL;
|
||||||
iterator->data = data;
|
iterator->data = data;
|
||||||
return iterator;
|
return iterator;
|
||||||
|
|||||||
Reference in New Issue
Block a user