From e18c67950ddd57b65933cb46cbd7d77e74f00faa Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Thu, 30 Jul 2020 19:19:38 +0200 Subject: Secured strdup --- src/u_vars.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/u_vars.c b/src/u_vars.c index 9978df5..377da77 100644 --- a/src/u_vars.c +++ b/src/u_vars.c @@ -127,7 +127,12 @@ static char } if (ptr != NULL) { - varval = ft_strdup(ptr->val); + if (!(varval = ft_strdup(ptr->val))) + { + lcom_clear(&msh->curr); + s_destroy(msh); + fail_alloc(msh); + } return (varval); } else -- cgit v1.2.3