title: Size of typedef does not change after malloc
body: <p>I have a small code that starts an rtsp server. After I start a specific server I add the information regarding to the server such as its processor id (because I start each server as a sub-process), what kind of source it has, port and mounting point name to an array of struct which I call <code>rtsp_server_list</code>. I have a <code>static int server_count = 1</code> at the beginning of code which increases by 1 whenever I add a new server. So my <code>add_server()</code> function is as follows:</p>
  
  <pre><code>struct rtsp_server_list* add_server() {
  
      char  *port, *mountName, *source;
      pid_t child_process_id;
      printf("Server count: %d\n", server_count);
      struct rtsp_server_list *server = malloc(server_count*sizeof(struct rtsp_server_list));
      printf("Size of server list: %lu\n", sizeof(server));
  
      source = malloc(256);
      port = malloc(256);
      mountName = malloc(256);
      g_print("Enter a source: ");
      scanf("%255s", source);
      g_print("Enter a port: ");
      scanf("%255s", port);
      g_print("Enter a mount name: ");
      scanf("%255s", mountName);
      child_process_id = fork();
      if (child_process_id &lt; 0) {
          perror("Fork for child failed.\n");
      } else if (child_process_id == 0) {
          g_print("Child process... \n");         
          execl("/home/tunc/workspace/gstreamer_rtsp_server/Debug/gstreamer_rtsp_server", "/home/tunc/workspace/gstreamer_rtsp_server/Debug/gstreamer_rtsp_server", source, port, mountName, NULL);
      } else {
          g_print("Child created, child is running.\n");
      }
      server[server_count-1].source = strdup(source);
      server[server_count-1].mountName = strdup(mountName);
      server[server_count-1].port = strdup(port);
      server[server_count-1].process_id = child_process_id;
      server_count++;
      // wait a bit to not mess the console outputs.
      sleep(1);
      return server;
  }
  </code></pre>
  
  <p>In the above code, size of <code>*server</code> never changes, it always stays at 8 bytes. But when I add a server <code>server count</code> increases by 1 so if I happen to add a 2nd server, <code>*server</code> should have size 16. Is it because I don't allocate memory for the <code>char</code> arrays in the struct? My struct is as follows:</p>
  
  <pre><code>struct rtsp_server_list {
      char *source;
      char *mountName;
      char *port;
      pid_t process_id;
  } rtsp_server_list;
  </code></pre>
  
  <p>I also have a code that removes an rtsp server by terminating its process but I am also not able to update the list in the way that I want. So what I am doing wrong? I tried doing these with <code>realloc</code> but results are exactly same.</p>