title: Uninitialised value was created by a stack allocation matrices mult
body: <p>I've got this function for matrices multiplication, standard triple for-loop.
  Input are pointers to two structs (shown below the function). Name of the function is at line 125 (line 126 is { ). It outputs correct numbers, tested on multiple inputs. However valgrind doesn't like it.</p>
  
  <pre><code>void matrix_mult(matrix_t* matrix_1, matrix_t* matrix_2)
  {
      int** mult;
      mult = calloc(matrix_1 -&gt; height, sizeof(int*));
      for (int i; i &lt; (matrix_1 -&gt; height); ++i)
      {
          mult[i] = calloc(matrix_2 -&gt; width, sizeof(int));
          for (int j = 0; j &lt; (matrix_2 -&gt; width); ++j)
          {
              for (int k = 0; k &lt; (matrix_1 -&gt; width); ++k)
              {
                  mult[i][j] += (matrix_1 -&gt; array[i][k]) * (matrix_2 -&gt; array[k][j]);
              }
          }
          free(matrix_1 -&gt; array[i]);
      }
      free(matrix_1 -&gt; array);
      matrix_1 -&gt; array = mult;
      matrix_1 -&gt; width = matrix_2 -&gt; width;
  }
  </code></pre>
  
  <p>And matrix_t is this struct:</p>
  
  <pre><code>struct matrix
  {
      int height;
      int width;
      int** array;
  };
  </code></pre>
  
  <p>valgrind output is:</p>
  
  <pre><code>==837== Conditional jump or move depends on uninitialised value(s)
  ==837==    at 0x400ED5: matrix_mult (main.c:129)
  ==837==    by 0x400F84: main (main.c:153)
  ==837==  Uninitialised value was created by a stack allocation
  ==837==    at 0x400D6C: matrix_mult (main.c:126)
  </code></pre>
  
  <p>same for:</p>
  
  <pre><code>matrix_mult (main.c:131)
  matrix_mult (main.c:131)
  matrix_mult (main.c:136)
  matrix_mult (main.c:139)
  </code></pre>