case 'h':
if (ldapServer) {
int len = strlen(ldapServer) + 1 + strlen(value) + 1;
- char *newhost = static_cast<char*>(malloc(len));
+ char *newhost = static_cast<char*>(xmalloc(len));
snprintf(newhost, len, "%s %s", ldapServer, value);
free(ldapServer);
ldapServer = newhost;
char *value = argv[1];
if (ldapServer) {
int len = strlen(ldapServer) + 1 + strlen(value) + 1;
- char *newhost = static_cast<char*>(malloc(len));
+ char *newhost = static_cast<char*>(xmalloc(len));
snprintf(newhost, len, "%s %s", ldapServer, value);
free(ldapServer);
ldapServer = newhost;
break;
if (strcmp(argv[i], "-W") == 0) {
- if ((dom = (struct SMBDOMAIN *) malloc(sizeof(struct SMBDOMAIN))) == NULL)
- return 1;
+ dom = static_cast<struct SMBDOMAIN *>(xmalloc(sizeof(struct SMBDOMAIN)));
dom->name = dom->sname = argv[++i];
dom->passthrough = "";
case 'h':
if (ldapServer) {
int len = strlen(ldapServer) + 1 + strlen(value) + 1;
- char *newhost = (char*)malloc(len);
+ char *newhost = static_cast<char*>(xmalloc(len));
snprintf(newhost, len, "%s %s", ldapServer, value);
free(ldapServer);
ldapServer = newhost;
char *value = argv[1];
if (ldapServer) {
int len = strlen(ldapServer) + 1 + strlen(value) + 1;
- char *newhost = (char*)malloc(len);
+ char *newhost = static_cast<char*>(xmalloc(len));
snprintf(newhost, len, "%s %s", ldapServer, value);
free(ldapServer);
ldapServer = newhost;
case 'h':
if (ldapServer) {
int len = strlen(ldapServer) + 1 + strlen(value) + 1;
- char *newhost = (char*)malloc(len);
+ char *newhost = static_cast<char*>(xmalloc(len));
snprintf(newhost, len, "%s %s", ldapServer, value);
free(ldapServer);
ldapServer = newhost;
char *value = argv[1];
if (ldapServer) {
int len = strlen(ldapServer) + 1 + strlen(value) + 1;
- char *newhost = (char*)malloc(len);
+ char *newhost = static_cast<char*>(xmalloc(len));
snprintf(newhost, len, "%s %s", ldapServer, value);
free(ldapServer);
ldapServer = newhost;
u = static_cast<user_data*>(xcalloc(1, sizeof(*u)));
if (realm) {
int len = strlen(user) + strlen(realm) + 2;
- u->hash.key = malloc(len);
+ u->hash.key = xmalloc(len);
snprintf(static_cast<char*>(u->hash.key), len, "%s:%s", user, realm);
} else {
u->hash.key = xstrdup(user);
case 'h':
if (ldapServer) {
int len = strlen(ldapServer) + 1 + strlen(value) + 1;
- char *newhost = (char*)malloc(len);
+ char *newhost = static_cast<char*>(xmalloc(len));
snprintf(newhost, len, "%s %s", ldapServer, value);
free(ldapServer);
ldapServer = newhost;
char *value = argv[1];
if (ldapServer) {
int len = strlen(ldapServer) + 1 + strlen(value) + 1;
- char *newhost = (char*)malloc(len);
+ char *newhost = static_cast<char*>(xmalloc(len));
snprintf(newhost, len, "%s %s", ldapServer, value);
free(ldapServer);
ldapServer = newhost;
bitwise AND */
/* the pointer to the first entry in the linked list */
- first_entry = (struct ip_user_dict*)malloc(sizeof(struct ip_user_dict));
+ first_entry = static_cast<struct ip_user_dict*>(xmalloc(sizeof(struct ip_user_dict)));
current_entry = first_entry;
unsigned int lineCount = 0;
/* get space and point current_entry to the new entry */
current_entry->next_entry =
- (struct ip_user_dict*)malloc(sizeof(struct ip_user_dict));
+ static_cast<struct ip_user_dict*>(xmalloc(sizeof(struct ip_user_dict)));
current_entry = current_entry->next_entry;
}
char *d, *c;
/* d will not be freed in case of non-error. Since we don't reconfigure,
* it's going to live as long as the process anyways */
- d = (char*)malloc(strlen(argv[j]) + 1);
+ d = static_cast<char*>(xmalloc(strlen(argv[j]) + 1));
strcpy(d, argv[j]);
debug("Adding domain-controller %s\n", d);
if (NULL == (c = strchr(d, '\\')) && NULL == (c = strchr(d, '/'))) {
}
*c= '\0';
++c;
- new_dc = (dc *) malloc(sizeof(dc));
+ new_dc = static_cast<dc *>(xmalloc(sizeof(dc)));
if (!new_dc) {
fprintf(stderr, "Malloc error while parsing DC options\n");
free(d);