ndr->print(ndr, "STRING BINDINGS");
ndr->depth++;
for (i=0;ar->stringbindings[i];i++) {
- char *idx = NULL;
- asprintf(&idx, "[%d]", i);
- if (idx) {
- ndr_print_STRINGBINDING(ndr, idx, ar->stringbindings[i]);
- free(idx);
- }
+ char idx[13]; /* 2^32 has 10 digits */
+ snprintf(idx, sizeof(idx), "[%d]", i);
+ ndr_print_STRINGBINDING(ndr, idx, ar->stringbindings[i]);
}
ndr->depth--;
ndr->print(ndr, "SECURITY BINDINGS");
ndr->depth++;
for (i=0;ar->securitybindings[i];i++) {
- char *idx = NULL;
- asprintf(&idx, "[%d]", i);
- if (idx) {
- ndr_print_SECURITYBINDING(ndr, idx, ar->securitybindings[i]);
- free(idx);
- }
+ char idx[13]; /* 2^32 has 10 digits */
+ snprintf(idx, sizeof(idx), "[%d]", i);
+ ndr_print_SECURITYBINDING(ndr, idx, ar->securitybindings[i]);
}
ndr->depth--;
}
ndr->print(ndr, "%-25s: STRINGARRAY", name);
ndr->depth++;
for (i=0;ar->stringbindings[i];i++) {
- char *idx = NULL;
- asprintf(&idx, "[%d]", i);
- if (idx) {
- ndr_print_STRINGBINDING(ndr, idx, ar->stringbindings[i]);
- free(idx);
- }
+ char idx[13]; /* 2^32 has 10 digits */
+ snprintf(idx, sizeof(idx), "[%d]", i);
+ ndr_print_STRINGBINDING(ndr, idx, ar->stringbindings[i]);
}
ndr->depth--;
}