diff options
Diffstat (limited to 'src/f_alloc.c')
-rw-r--r-- | src/f_alloc.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/f_alloc.c b/src/f_alloc.c index bfa75c3..62b7008 100644 --- a/src/f_alloc.c +++ b/src/f_alloc.c @@ -21,16 +21,20 @@ #include "s_struct.h" void - f_fail_alloc(t_msh *msh) + f_alloc_and_destroy_msh(t_msh *msh) { - ft_dprintf(STDERR_FILENO, "%s: %s\n", msh->shname, strerror(errno)); + char tmp[255]; + + lcom_clear(&msh->curr); + ft_strlcpy(tmp, msh->shname, ft_strlen(msh->shname) + 1); + s_destroy(msh); + ft_dprintf(STDERR_FILENO, "%s: %s\n", tmp, strerror(errno)); exit(FT_RET_ALLOC); } void - f_fail_alloc_and_destroy(t_msh *msh) + f_alloc_and_clear_lcom(t_msh *msh) { lcom_clear(&msh->curr); - s_destroy(msh); - f_fail_alloc(msh); + ft_dprintf(STDERR_FILENO, "%s: %s\n", msh->shname, strerror(errno)); } |