title: "points to uninitialised byte(s)" Valgrind errors
body: <p>I've been using <strong>Valgrind</strong> to look for memory leaks in my code, and while no memory leaks are being found, some errors are reported all of them originating at a single function/class method:</p>
  
  <pre><code>==17043== ERROR SUMMARY: 10100 errors from 3 contexts (suppressed: 0 from 0)
  ==17043== 
  ==17043== 100 errors in context 1 of 3:
  ==17043== Syscall param socketcall.sendto(msg) points to uninitialised byte(s)
  ==17043==    at 0x5441DA2: send (send.c:28)
  ==17043==    by 0x404C2D: unix_socket::sendMsg(char, double) (in /home/joao/CloudPT/Bolsa/Webots/controllers/darwin-pi2/client)
  ==17043==    by 0x404F1C: unix_socket::sendVectorXd(Eigen::Matrix&lt;double, -1, 1, 0, -1, 1&gt; const&amp;) (in /home/joao/CloudPT/Bolsa/Webots/controllers/darwin-pi2/client)
  ==17043==    by 0x401F2A: main (in /home/joao/CloudPT/Bolsa/Webots/controllers/darwin-pi2/client)
  ==17043==  Address 0x7feffff61 is on thread 1's stack
  ==17043==  Uninitialised value was created by a stack allocation
  ==17043==    at 0x404BE6: unix_socket::sendMsg(char, double) (in /home/joao/CloudPT/Bolsa/Webots/controllers/darwin-pi2/client)
  ==17043== 
  ==17043== 
  ==17043== 100 errors in context 2 of 3:
  ==17043== Syscall param socketcall.sendto(msg) points to uninitialised byte(s)
  ==17043==    at 0x5441DA2: send (send.c:28)
  ==17043==    by 0x404C2D: unix_socket::sendMsg(char, double) (in /home/joao/CloudPT/Bolsa/Webots/controllers/darwin-pi2/client)
  ==17043==    by 0x404E8A: unix_socket::sendVectorXd(Eigen::Matrix&lt;double, -1, 1, 0, -1, 1&gt; const&amp;) (in /home/joao/CloudPT/Bolsa/Webots/controllers/darwin-pi2/client)
  ==17043==    by 0x401F2A: main (in /home/joao/CloudPT/Bolsa/Webots/controllers/darwin-pi2/client)
  ==17043==  Address 0x7feffff61 is on thread 1's stack
  ==17043==  Uninitialised value was created by a stack allocation
  ==17043==    at 0x404BE6: unix_socket::sendMsg(char, double) (in /home/joao/CloudPT/Bolsa/Webots/controllers/darwin-pi2/client)
  ==17043== 
  ==17043== 
  ==17043== 9900 errors in context 3 of 3:
  ==17043== Syscall param socketcall.sendto(msg) points to uninitialised byte(s)
  ==17043==    at 0x5441DA2: send (send.c:28)
  ==17043==    by 0x404C2D: unix_socket::sendMsg(char, double) (in /home/joao/CloudPT/Bolsa/Webots/controllers/darwin-pi2/client)
  ==17043==    by 0x404EE8: unix_socket::sendVectorXd(Eigen::Matrix&lt;double, -1, 1, 0, -1, 1&gt; const&amp;) (in /home/joao/CloudPT/Bolsa/Webots/controllers/darwin-pi2/client)
  ==17043==    by 0x401F2A: main (in /home/joao/CloudPT/Bolsa/Webots/controllers/darwin-pi2/client)
  ==17043==  Address 0x7feffff61 is on thread 1's stack
  ==17043==  Uninitialised value was created by a stack allocation
  ==17043==    at 0x404BE6: unix_socket::sendMsg(char, double) (in /home/joao/CloudPT/Bolsa/Webots/controllers/darwin-pi2/client)
  ==17043== 
  ==17043== ERROR SUMMARY: 10100 errors from 3 contexts (suppressed: 0 from 0)
  </code></pre>
  
  <p>The <code>sendMsg(const char _type, const double _value)</code>, that the errors are pointing at, is part of <code>unix_socket</code> class:</p>
  
  <pre><code>//...
  typedef struct{
      char type;    
      double value; 
  } MESSAGE;
  
  //...
  int unix_socket::sendMsg(const char _type, const double _value){
      MESSAGE msg;
      msg.type=_type;
      msg.value=_value;
      int n = send(client_sock, &amp;msg, sizeof(msg), 0);
      if (n &lt; 0) {
          perror("send");
          return -1;
      } 
      c_sent=msg.type;
      v_sent=msg.value;
      return 0;
  }
  </code></pre>
  
  <p>I don't see what is the problem. Where exactly are the uninitialized values? Or should I just ignore the errors reported by Valgrind?</p>