1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-07-16 08:41:51 +03:00

examples: Check allocation results to give better examples

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:
Jakub Jelen
2023-06-27 14:55:54 +02:00
parent cba1dfac6c
commit ccc7302fc8
2 changed files with 23 additions and 5 deletions

View File

@ -94,6 +94,9 @@ cleanup_push(struct cleanup_node_struct** head_ref,
{
// Allocate memory for node
struct cleanup_node_struct *new_node = malloc(sizeof *new_node);
if (new_node == NULL) {
return;
}
if (*head_ref != NULL) {
new_node->next = *head_ref;