u_char *buf; libnet_init_packet(IP_H + TCP_H, &buf); /* This calls malloc() and sets buf as a pointer to that new memory */ [...] libnet_build_ip([...], buf); /* The pointer value is the same, but data pointed to is altered */