met le dernier element du char** a null dans add_to_list et parse
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
/* By: hulamy <hulamy@student.42.fr> +#+ +:+ +#+ */
|
/* By: hulamy <hulamy@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2019/04/14 15:20:53 by hulamy #+# #+# */
|
/* Created: 2019/04/14 15:20:53 by hulamy #+# #+# */
|
||||||
/* Updated: 2019/04/16 15:32:14 by hulamy ### ########.fr */
|
/* Updated: 2019/04/16 16:08:24 by hulamy ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -31,6 +31,7 @@ char **fill_tetraminos(char **square, int *tab)
|
|||||||
length = tab[3] - tab[1] + 1;
|
length = tab[3] - tab[1] + 1;
|
||||||
if (!(result = (char**)malloc(sizeof(*result) * (height + 1))))
|
if (!(result = (char**)malloc(sizeof(*result) * (height + 1))))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
result[height] = NULL;
|
||||||
while (i < height)
|
while (i < height)
|
||||||
{
|
{
|
||||||
if (!(result[i] = (char*)malloc(sizeof(**result) * (length + 1))))
|
if (!(result[i] = (char*)malloc(sizeof(**result) * (length + 1))))
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2019/04/15 14:48:14 by vmanzoni #+# #+# */
|
/* Created: 2019/04/15 14:48:14 by vmanzoni #+# #+# */
|
||||||
/* Updated: 2019/04/16 15:28:11 by hulamy ### ########.fr */
|
/* Updated: 2019/04/16 16:08:03 by hulamy ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -23,8 +23,9 @@ char **create_square(char *tetri)
|
|||||||
int k;
|
int k;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
if (!(square = (char**)malloc(sizeof(*square) * 4)))
|
if (!(square = (char**)malloc(sizeof(*square) * (4 + 1))))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
square[4] = NULL;
|
||||||
while (*tetri && (k = -1))
|
while (*tetri && (k = -1))
|
||||||
{
|
{
|
||||||
if (!(square[i] = (char*)malloc(sizeof(**square) * (4 + 1))))
|
if (!(square[i] = (char*)malloc(sizeof(**square) * (4 + 1))))
|
||||||
|
|||||||
Reference in New Issue
Block a user