title: getline into char** yields only the last line
body: <p>I'm trying to store the line from getline(..., line, ...) into char** array.
  But when I iterate through the array to print the lines, it only prints the last line.
  I think there's something in the man that I missed.</p>
  
  <p><a href="https://i.stack.imgur.com/Mlq4a.png" rel="nofollow noreferrer">the input file</a></p>
  
  <p><a href="https://i.stack.imgur.com/Uf61R.png" rel="nofollow noreferrer">standard output</a></p>
  
  <pre><code>int fill_map(t_args *args)
  {
      char *line = NULL;
      args-&gt;maze = NULL;
      int i = 0;
      size_t len = 0;
      ssize_t nread;
  
      args-&gt;maze = malloc(sizeof(char *));
      for (size_t j = 0; (nread = getline(&amp;line, &amp;len, args-&gt;stream)) != -1; i++)
      {
          if (i == 1)
              args-&gt;width = (int)nread;
          args-&gt;maze = realloc(args-&gt;maze, sizeof(char *) * (i + 1));
          args-&gt;maze[i] = line;
      }
      args-&gt;height = i;
  
      for (size_t i = 0; i &lt; (size_t)args-&gt;height; i++)
      {
          printf("%ld %s", i, args-&gt;maze[i]);
      }
  
      return nread;
  }
  </code></pre>