title: Valgrind's error message
body: <p>I got "Conditional jump or move depends on uninitialised value(s)" , and it is coming from function <code>process_server()</code>. I have tried to figure out where it is coming, but to no avail. </p>
  
  <p>Message from <code>valgrind</code>.</p>
  
  <blockquote>
  ==2468== Conditional jump or move depends on uninitialised value(s)<br />
  ==2468==    at 0x402B3D: process_server (in /home/emeka/Desktop/dump/project/serverd)<br />
  ==2468==    by 0x402DB3: main (in /home/emeka/Desktop/dump/project/serverd)<br />
  ==2468== 
  </blockquote>
  
  <pre><code>#include "signal.h"
  #include "string.h"
  #include "sys/types.h"
  #include "unistd.h"
  #include "sys/socket.h"
  #include "netinet/in.h"
  #include "arpa/inet.h"
  #include "netdb.h"
  #include "stdlib.h"
  #include "ctype.h"
  #include "stdio.h"
  #include "utility.h"
  #include "route.c"
  #include "tokenize.c"
  #include "bridge.c"
  
  
  
  
  #define PORT 1253
  #define ADDRESS "127.0.0.1"
  #define START  "start"
  #define  STOP  "stop"
  #define LISTENQ 4
  
  typedef struct sockaddr SA;
  //#define INET6_ADDRSTRLEN 3000
  requested_data *re_data;
  
  int switch_ch;
  struct sockaddr_in serveraddr;
  
  int start_server(int port){
      int listenid;
      int optval=1;
      typedef struct sockaddr SA;
      if((listenid = socket(AF_INET, SOCK_STREAM, 0)) &lt; 0) {
          error_message("Error in startServer &lt;Failed to create socket&gt;");
      }
      if (setsockopt(listenid, SOL_SOCKET, SO_REUSEADDR,
                     (const void *)&amp;optval , sizeof(int)) &lt; 0)
              return -1;
      memset(&amp;serveraddr, 0, sizeof(serveraddr));
      serveraddr.sin_family = AF_INET;
      serveraddr.sin_addr.s_addr = htonl(INADDR_ANY);
      serveraddr.sin_port = htons((unsigned short)port);
      if(bind(listenid, (SA*)&amp;serveraddr, sizeof(serveraddr)) &lt; 0) {
          error_message("Error in startServer &lt;Failed to bind socket&gt;");
      }
      if(listen(listenid, LISTENQ) &lt; 0) {
          error_message("Error in startServer &lt;Failed to listen&gt;");
      }
  
  
      return listenid;
  }
  
  
  void *get_in_addr(struct sockaddr *sa)
  {
      if (sa-&gt;sa_family == AF_INET) {
          return &amp;(((struct sockaddr_in*)sa)-&gt;sin_addr);
      }
  
      return &amp;(((struct sockaddr_in6*)sa)-&gt;sin6_addr);
  }
  
  void process_server(int listenid){
      char remoteIP[INET6_ADDRSTRLEN];
      int fd, read_size;
          const int buffer_size = 1000;
      char *client_message = malloc(sizeof(char) * buffer_size);
          if(!client_message){
             printf("Not enough memory");
             abort();
           }
      struct sockaddr_storage remoteaddr; // client address
      socklen_t addrlen;
      addrlen = sizeof remoteaddr;
      char *gen, gen_int = 0, supplied_answer;
          while((fd = accept(listenid, (struct sockaddr *)&amp;remoteaddr, &amp;addrlen))) {
          while((read_size = recv(fd, client_message, buffer_size, 0)) &gt; 0) {
              printf("%s", client_message);
              re_data = router(client_message, read_size);
              printf("Method %s --url::%s=+++\n", re_data-&gt;method, re_data-&gt;url);
              switch_ch = 1;
              free(client_message);
              client_message = malloc(sizeof(char) * buffer_size);
              if(!client_message){
                  printf("Not enough memory");
                  abort();
              }
              break;
  
          }
          printf("DE server: new connection from %s on "
                              "socket %d\n",
                              inet_ntop(remoteaddr.ss_family,
                                  get_in_addr((struct sockaddr*)&amp;remoteaddr),
                                  remoteIP, INET6_ADDRSTRLEN),fd);
          str_query *rem_data;
          str_query *header_meta = re_data-&gt;meta_data;
           while(header_meta){
              if(strncasecmp(re_data-&gt;method, "PUT", 3) == 0){
                  if(strncasecmp(re_data-&gt;url, "/answer", 7) == 0){
                      if(strlen(re_data-&gt;url) == 7){
                          if(strncasecmp(header_meta-&gt;req_name, "question", 8) == 0){
  
                              int res_int = parse_input(header_meta-&gt;req_value);
  
                              if(gen_int == res_int &amp;&amp; supplied_answer == res_int){
                                  send(fd, "HTTP status 200 OK" , 18, 0);
                              } else {
                                  send(fd, "400 Bad Request" , 15, 0);
                              }
  
                              printf("\n Resulted from computation  of %s  result :: %d\n", header_meta-&gt;req_name, res_int);
  
                          }
                      }
  
                  }
              }
              if(switch_ch){
                  if(strncasecmp(re_data-&gt;url, "/question" , 9) == 0){
                      if(strncasecmp(re_data-&gt;method, "GET", 3) == 0){
                          gen = pmain();
                          send(fd, gen, strlen(gen), 0);
                          gen_int = parse_input(gen);
                          switch_ch = 0;
                          printf("\n Resulted from generated computation  of %s  result :: %d\n", header_meta-&gt;req_name, gen_int);
                          free(gen);
                      }
                  }
              }
              if(strncasecmp(header_meta-&gt;req_name, "answer", 8) == 0){
                  supplied_answer = atoi(header_meta-&gt;req_value);
  
              }
  
              printf("\nname %s    value %s\n", header_meta-&gt;req_name, header_meta-&gt;req_value);
              rem_data = header_meta;
              header_meta = header_meta-&gt;next;
              free(rem_data-&gt;req_name);
                          free(rem_data-&gt;req_value);
  
              free(rem_data);
  
          }   
          if(!client_message){
             free(client_message);
          }   
          free(re_data);
          close(fd);
      }
      return;
  
  }
  
  
  int main(int argc, char **argv) {
      int port, pid, server_conn = 1;
      int internet_address_len = 15;
      char serAdd[internet_address_len];
      char strAction[7];
      if(argc == 1) {
          port = PORT;
          strcpy(serAdd, ADDRESS);
      } else if(argc == 2){
          port = atoi(argv[1]);
          strcpy(serAdd, ADDRESS);
      } else if(argc == 3) {
          port = atoi(argv[1]);
          int n = strlen(argv[2]);
          strncpy(serAdd, argv[2], n);
          if(n &gt;= internet_address_len){
              error_message("Internet address is incorrect");
          }
          serAdd[n] = '\0';
      }
      printf("\n\tDE is a basic server built to carry out simple things\n"
              "\t-----    -----\n"
              "\t|    |   |\n"
              "\t|    |   -----\n"
              "\t|    |   |\n"
              "\t-----    -----\n"
             "\tMethods implemented [Get &amp; Put]\n"
             "\tTo start type start\n"
              "\tTo stop type stop\nDE]");
      scanf("%s", strAction);
      if (strcmp(strAction, START) == 0){
          printf("Server %sed\n", START);
          int listenid = start_server(port);
          printf("listen on port %d &amp; listening is %d\nDE]", port,listenid);
          signal(SIGPIPE, SIG_IGN);
          while(server_conn) {
              pid =fork();
              if(pid == 0) {
                  process_server(listenid);
                  break;              
              }
              scanf("%s", strAction);
              if (strcmp(strAction, STOP) == 0) {
                  close(listenid);
                  return 0;
              }
  
          }
  
      }
  
      return 0;
  
  }
  </code></pre>