Browse Source

[mod] mleaks: reduce number max of blocks to five.

Moul 3 years ago
parent
commit
ab6f26f41f
2 changed files with 3 additions and 3 deletions
  1. 1 1
      src/cmd_splitting.c
  2. 2 2
      src/detect_cotes.c

+ 1 - 1
src/cmd_splitting.c

@@ -20,7 +20,7 @@ char	**cmd_splitting(t_e *e, char *cmd, char c)
 	nbr = 0;
 	if (ft_strcmp(cmd, "") == 0)
 		return (NULL);
-	poss = (int*)malloc(sizeof(int) * 50);
+	poss = (int*)malloc(sizeof(int) * 5);
 	while (cmd[++pos] != '\0')
 		if (cmd[pos] == c && (pos > 0 ? c != cmd[pos - 1] : 1)\
 			&& is_on_coted_block(e, e->slen + pos) == 1)

+ 2 - 2
src/detect_cotes.c

@@ -7,12 +7,12 @@ void	init_detect_blocks(t_e *e, char *line)
 
 	pos = 0;
 	b_pos = 0;
-	e->b = (t_block**)malloc(sizeof(t_block*) * 50);
+	e->b = (t_block**)malloc(sizeof(t_block*) * 5);
 	detect_blocks(e, line, pos, b_pos);
 }
 
 /*
-** arbitrary value to 50 blocks max
+** set arbitrary value to 5 blocks max
 ** While not scanned all string
 ** If found opening and close cotes and non-coted block before:
 ** - retrieve coted block