diff options
Diffstat (limited to '')
-rw-r--r-- | src/libmdsserver/client-list.c | 4 | ||||
-rw-r--r-- | src/libmdsserver/linked-list.c | 8 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/libmdsserver/client-list.c b/src/libmdsserver/client-list.c index 5562747..1bcaa72 100644 --- a/src/libmdsserver/client-list.c +++ b/src/libmdsserver/client-list.c @@ -101,6 +101,7 @@ int client_list_clone(const client_list_t* restrict this, client_list_t* restric { size_t n = this->capacity * sizeof(uint64_t); uint64_t* restrict new_clients = NULL; + int saved_errno; out->clients = NULL; @@ -116,8 +117,9 @@ int client_list_clone(const client_list_t* restrict this, client_list_t* restric return 0; pfail: + saved_errno = errno; free(new_clients); - return -1; + return errno = saved_errno, -1; } diff --git a/src/libmdsserver/linked-list.c b/src/libmdsserver/linked-list.c index 83f7711..d17ba8b 100644 --- a/src/libmdsserver/linked-list.c +++ b/src/libmdsserver/linked-list.c @@ -116,6 +116,7 @@ int linked_list_clone(const linked_list_t* restrict this, linked_list_t* restric ssize_t* restrict new_next = NULL; ssize_t* restrict new_previous = NULL; ssize_t* restrict new_reusable; + int saved_errno; out->values = NULL; out->next = NULL; @@ -145,10 +146,11 @@ int linked_list_clone(const linked_list_t* restrict this, linked_list_t* restric return 0; pfail: + saved_errno = errno; free(new_values); free(new_next); free(new_previous); - return -1; + return errno = saved_errno, -1; } @@ -177,6 +179,7 @@ int linked_list_pack(linked_list_t* restrict this) size_t i = 0; ssize_t node; size_t* restrict vals; + int saved_errno; if (xmalloc(vals, cap, size_t)) return -1; @@ -219,10 +222,11 @@ int linked_list_pack(linked_list_t* restrict this) return 0; pfail: + saved_errno = errno; free(vals); free(new_next); free(new_previous); - return -1; + return errno = saved_errno, -1; } |