GNUNET_GETOPT_OPTION_END
};
- struct vpn_cls* cls = (struct vpn_cls*)malloc(sizeof(struct vpn_cls));
+ struct vpn_cls* cls = GNUNET_malloc(sizeof(struct vpn_cls));
return (GNUNET_OK ==
GNUNET_PROGRAM_run (argc,
gettext_noop ("help text"),
options, &run, cls)) ? ret : 1;
- free(cls); // Make clang happy
+ GNUNET_free(cls); // Make clang happy
}
/* end of gnunet-daemon-vpn.c */
}}}
void pkt_printf(struct ip6_pkt* pkt) {{{
- char* buf = (char*)malloc(strlen(pretty)+1);
+ char* buf = alloca(strlen(pretty)+1);
char tmp[9];
memcpy(buf, pretty, strlen(pretty)+1);
}
printf("%s", buf);
- free(buf);
}}}
void pkt_printf_ip6tcp(struct ip6_tcp* pkt) {{{
printf("\t#ns: %d\n", ntohs(pkt->data.nscount));
printf("\t#ar: %d\n", ntohs(pkt->data.arcount));
- struct dns_query** queries = (struct dns_query**)malloc(qdcount*sizeof(struct dns_query*));
+ struct dns_query** queries = alloca(qdcount*sizeof(struct dns_query*));
unsigned int idx = 0;
int i;
for (i = 0; i < qdcount; i++) {
- queries[i] = (struct dns_query*)malloc(sizeof(struct dns_query));
- queries[i]->name = (unsigned char*)malloc(255); // see RFC1035
+ queries[i] = alloca(sizeof(struct dns_query));
+ queries[i]->name = alloca(255); // see RFC1035
unsigned char* name = queries[i]->name;
int len = pkt->data.data[idx++];
while (len != 0) {