чување 4f86b64404f66388aeb85e0737d1c097e7f02c76
родитељ 622f139c5178809e94f6da74cc24d92514620bfa
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Sun, 11 Apr 2021 14:45:28 +0200
Added allocation check
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 1, додавања: 2(+), брисања: 0(-)
diff --git a/reflow.c b/reflow.c
@@ -128,6 +128,8 @@ main()
}
empty_line = line_len == 0;
line = calloc(line_len+1, 1);
+ if (!line)
+ exit(error(ENOMEM, "Memory allocation failed"));
strncpy(line, pbuffer, line_len);
*(line+line_len) = 0;
printf("%s", line);