diff --git a/c-programming/io/freadln.c b/c-programming/io/freadln.c index a98c5f4..9a56378 100644 --- a/c-programming/io/freadln.c +++ b/c-programming/io/freadln.c @@ -37,8 +37,10 @@ int freadln(FILE* f, char** output, size_t* length_out) { freadln_length_type length = 0; // initial length *output = malloc((length + 1) * sizeof(char)); - if (*output == NULL) + if (*output == NULL) { + errno = EINVAL; return freadln_ERROR; + } int character; while ((character = fgetc(f)) != EOF