This will make sure the full buffer is initialized even if some
fields were not explicitly set.
pimdev_hdr *hdr;
char *pos;
pimdev_hdr *hdr;
char *pos;
- hdr = malloc(sizeof(*hdr) + ETH_ALEN);
+ hdr = os_zalloc(sizeof(*hdr) + ETH_ALEN);
if (hdr == NULL)
return -1;
hdr->op = htonl(PIMOP_SET);
if (hdr == NULL)
return -1;
hdr->op = htonl(PIMOP_SET);
int ret = 0;
blen = sizeof(struct obj_stakey) + sizeof(pimdev_hdr);
int ret = 0;
blen = sizeof(struct obj_stakey) + sizeof(pimdev_hdr);
if (hdr == NULL) {
printf("memory low\n");
return -1;
if (hdr == NULL) {
printf("memory low\n");
return -1;
int ret = 0;
blen = sizeof(*stasc) + sizeof(*hdr);
int ret = 0;
blen = sizeof(*stasc) + sizeof(*hdr);
if (hdr == NULL)
return -1;
if (hdr == NULL)
return -1;
unsigned long *ul;
int blen = sizeof(*hdr) + sizeof(*ul);
unsigned long *ul;
int blen = sizeof(*hdr) + sizeof(*ul);
if (hdr == NULL)
return -1;
if (hdr == NULL)
return -1;
unsigned long *ul;
int ret;
int blen = sizeof(*hdr) + sizeof(*ul);
unsigned long *ul;
int ret;
int blen = sizeof(*hdr) + sizeof(*ul);
if (hdr == NULL)
return -1;
ul = (unsigned long *) &hdr[1];
if (hdr == NULL)
return -1;
ul = (unsigned long *) &hdr[1];
struct obj_mlmeex *mlme;
int ret;
int blen = sizeof(*hdr) + sizeof(*mlme);
struct obj_mlmeex *mlme;
int ret;
int blen = sizeof(*hdr) + sizeof(*mlme);
if (hdr == NULL)
return -1;
mlme = (struct obj_mlmeex *) &hdr[1];
if (hdr == NULL)
return -1;
mlme = (struct obj_mlmeex *) &hdr[1];
struct obj_mlmeex *mlme;
int ret;
int blen = sizeof(*hdr) + sizeof(*mlme);
struct obj_mlmeex *mlme;
int ret;
int blen = sizeof(*hdr) + sizeof(*mlme);
if (hdr == NULL)
return -1;
mlme = (struct obj_mlmeex *) &hdr[1];
if (hdr == NULL)
return -1;
mlme = (struct obj_mlmeex *) &hdr[1];
int blen = sizeof(*hdr) + sizeof(*sta);
int ret;
int blen = sizeof(*hdr) + sizeof(*sta);
int ret;
if (hdr == NULL)
return -1;
hdr->op = htonl(PIMOP_GET);
if (hdr == NULL)
return -1;
hdr->op = htonl(PIMOP_GET);