diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/cc4group.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/cc4group.c b/src/cc4group.c index 56d307a..7a550cd 100644 --- a/src/cc4group.c +++ b/src/cc4group.c @@ -133,7 +133,10 @@ static char* cc4group_strerrorFormatter(int32_t const code, const char* const me { (void)data; char* message; - asprintf(&message, "%s: %s: %s (%d)", method, causer, strerror(code), code); + if(asprintf(&message, "%s: %s: %s (%d)", method, causer, strerror(code), code) == -1) + { + return NULL; + } return message; } @@ -152,7 +155,10 @@ static char* cc4group_zerrorFormatter(int32_t const code, const char* const meth if(code == CC4GROUP_MEM_ERROR) { errorString = ""; - asprintf(&message, "%s: %s: Can't allocate memory for copying the input data: %s (%d)", method, causer, strerror(storedErrno), storedErrno); + if(asprintf(&message, "%s: %s: Can't allocate memory for copying the input data: %s (%d)", method, causer, strerror(storedErrno), storedErrno) == -1) + { + return NULL; + } return message; } @@ -169,7 +175,10 @@ static char* cc4group_zerrorFormatter(int32_t const code, const char* const meth errorString = zError(code); } - asprintf(&message, "%s: %s: %s (%d)", method, causer, errorString, code); + if(asprintf(&message, "%s: %s: %s (%d)", method, causer, errorString, code) == -1) + { + return NULL; + } return message; } @@ -179,7 +188,10 @@ static char* cc4group_messageFormatter(int32_t const code, const char* const met (void)data; char* message; - asprintf(&message, "%s: %s", method, causer); + if(asprintf(&message, "%s: %s", method, causer) == -1) + { + return NULL; + } return message; } |
