corrected invalid read on print_map
caused by exessive ft_strdel instruction in lm_parser
This commit is contained in:
		@@ -6,7 +6,7 @@
 | 
			
		||||
/*   By: mndhlovu <marvin@42.fr>                    +#+  +:+       +#+        */
 | 
			
		||||
/*                                                +#+#+#+#+#+   +#+           */
 | 
			
		||||
/*   Created: 2019/03/25 06:31:05 by mndhlovu          #+#    #+#             */
 | 
			
		||||
/*   Updated: 2019/04/29 12:40:52 by mndhlovu         ###   ########.fr       */
 | 
			
		||||
/*   Updated: 2019/04/29 12:54:07 by tmaze            ###   ########.fr       */
 | 
			
		||||
/*                                                                            */
 | 
			
		||||
/* ************************************************************************** */
 | 
			
		||||
 | 
			
		||||
@@ -22,7 +22,7 @@ static int		lem_in(t_syntax *synt, t_holder *holder,
 | 
			
		||||
		return (0);
 | 
			
		||||
	if ((lm_adj_parser(lmdata, holder) == 0))
 | 
			
		||||
		return (0);
 | 
			
		||||
	//print_map(lmdata);
 | 
			
		||||
	print_map(lmdata);
 | 
			
		||||
	lm_clear_unv(holder);
 | 
			
		||||
	get_nb_paths_max(lmdata, get_node_role(lmdata, 's')->ind
 | 
			
		||||
					, get_node_role(lmdata, 'e')->ind);
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@
 | 
			
		||||
/*   By: mndhlovu <mndhlovu@student.42.fr>          +#+  +:+       +#+        */
 | 
			
		||||
/*                                                +#+#+#+#+#+   +#+           */
 | 
			
		||||
/*   Created: 2019/04/20 15:24:51 by mndhlovu          #+#    #+#             */
 | 
			
		||||
/*   Updated: 2019/04/29 12:45:25 by mndhlovu         ###   ########.fr       */
 | 
			
		||||
/*   Updated: 2019/04/29 13:07:10 by tmaze            ###   ########.fr       */
 | 
			
		||||
/*                                                                            */
 | 
			
		||||
/* ************************************************************************** */
 | 
			
		||||
 | 
			
		||||
@@ -84,17 +84,10 @@ int				lm_parser(t_syntax *synt
 | 
			
		||||
		if ((add_line_map(ldata, raw)))
 | 
			
		||||
			return (0);
 | 
			
		||||
		if (!(lm_get_ant_(index, ldata, synt, raw)) && index == 0)
 | 
			
		||||
		{
 | 
			
		||||
			//ft_strdel(&raw);
 | 
			
		||||
			return (0);
 | 
			
		||||
		}
 | 
			
		||||
		lm_locate_cd(index, synt, raw);
 | 
			
		||||
		if (!(lm_get_vertices(index, synt, ldata, holder, raw)))
 | 
			
		||||
		{
 | 
			
		||||
			ft_strdel(&raw);
 | 
			
		||||
			return (0);
 | 
			
		||||
		}
 | 
			
		||||
		ft_strdel(&raw);
 | 
			
		||||
		index++;
 | 
			
		||||
	}
 | 
			
		||||
	ft_strdel(&raw);
 | 
			
		||||
 
 | 
			
		||||
@@ -6,11 +6,12 @@
 | 
			
		||||
/*   By: tmaze <tmaze@student.42.fr>                +#+  +:+       +#+        */
 | 
			
		||||
/*                                                +#+#+#+#+#+   +#+           */
 | 
			
		||||
/*   Created: 2019/04/24 17:35:29 by tmaze             #+#    #+#             */
 | 
			
		||||
/*   Updated: 2019/04/29 12:40:25 by mndhlovu         ###   ########.fr       */
 | 
			
		||||
/*   Updated: 2019/04/29 13:05:56 by tmaze            ###   ########.fr       */
 | 
			
		||||
/*                                                                            */
 | 
			
		||||
/* ************************************************************************** */
 | 
			
		||||
 | 
			
		||||
#include "lem_in.h"
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
void	del_map(t_lmdata *data)
 | 
			
		||||
{
 | 
			
		||||
@@ -18,9 +19,9 @@ void	del_map(t_lmdata *data)
 | 
			
		||||
 | 
			
		||||
	while (data->map)
 | 
			
		||||
	{
 | 
			
		||||
		ft_strdel(&(data->map->line));
 | 
			
		||||
		tmp = data->map;
 | 
			
		||||
		data->map = data->map->next;
 | 
			
		||||
		ft_strdel(&(tmp->line));
 | 
			
		||||
		ft_memdel((void**)&tmp);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user