mirror of
https://github.com/samba-team/samba.git
synced 2025-03-08 04:58:40 +03:00
move to SAFE_FREE()
This commit is contained in:
parent
fc71962409
commit
67db8f03c5
@ -154,8 +154,8 @@ static void lookup_strings(FILE *fichier)
|
||||
temp2=(char *)malloc(sizeof(pstring));
|
||||
|
||||
if(temp == NULL || temp2 == NULL) {
|
||||
safe_free(temp);
|
||||
safe_free(temp2);
|
||||
SAFE_FREE(temp);
|
||||
SAFE_FREE(temp2);
|
||||
fprintf(stderr,"lookup_strings: malloc fail !\n");
|
||||
exit(1);
|
||||
}
|
||||
@ -218,8 +218,8 @@ static void lookup_entry(FILE *fichier,char *chaine)
|
||||
temp2=(char *)malloc(sizeof(pstring));
|
||||
|
||||
if(temp == NULL || temp2 == NULL) {
|
||||
safe_free(temp);
|
||||
safe_free(temp2);
|
||||
SAFE_FREE(temp);
|
||||
SAFE_FREE(temp2);
|
||||
fprintf(stderr,"lookup_entry: malloc fail !\n");
|
||||
exit(1);
|
||||
}
|
||||
@ -276,9 +276,9 @@ static char *find_desc(FILE *fichier,char *text)
|
||||
long_desc=(char *)malloc(sizeof(pstring));
|
||||
short_desc=(char *)malloc(sizeof(pstring));
|
||||
if (!chaine || !long_desc || !short_desc) {
|
||||
safe_free(chaine);
|
||||
safe_free(long_desc);
|
||||
safe_free(short_desc);
|
||||
SAFE_FREE(chaine);
|
||||
SAFE_FREE(long_desc);
|
||||
SAFE_FREE(short_desc);
|
||||
fprintf(stderr,"find_desc: Unable to malloc memory\n");
|
||||
exit(1);
|
||||
}
|
||||
@ -307,7 +307,7 @@ static char *find_desc(FILE *fichier,char *text)
|
||||
if (!strcmp(text,long_desc))
|
||||
found=1;
|
||||
}
|
||||
free(chaine);
|
||||
SAFE_FREE(chaine);
|
||||
if (!found || !crap) return(NULL);
|
||||
while(*crap==' ') crap++;
|
||||
pstrcpy(short_desc,crap);
|
||||
|
@ -124,7 +124,7 @@ static void do_node_status(int fd, char *name, int type, struct in_addr ip)
|
||||
cleanname,status[i].type,
|
||||
node_status_flags(status[i].flags));
|
||||
}
|
||||
free(status);
|
||||
SAFE_FREE(status);
|
||||
}
|
||||
d_printf("\n");
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ static BOOL add_ace(SEC_ACL **the_acl, SEC_ACE *ace)
|
||||
memcpy(aces, (*the_acl)->ace, (*the_acl)->num_aces * sizeof(SEC_ACE));
|
||||
memcpy(aces+(*the_acl)->num_aces, ace, sizeof(SEC_ACE));
|
||||
new = make_sec_acl(ctx,(*the_acl)->revision,1+(*the_acl)->num_aces, aces);
|
||||
free(aces);
|
||||
SAFE_FREE(aces);
|
||||
(*the_acl) = new;
|
||||
return True;
|
||||
}
|
||||
@ -391,8 +391,8 @@ static SEC_DESC *sec_desc_parse(char *str)
|
||||
ret = make_sec_desc(ctx,revision, owner_sid, grp_sid,
|
||||
NULL, dacl, &sd_size);
|
||||
|
||||
if (grp_sid) free(grp_sid);
|
||||
if (owner_sid) free(owner_sid);
|
||||
SAFE_FREE(grp_sid);
|
||||
SAFE_FREE(owner_sid);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -605,10 +605,8 @@ static int cacl_set(struct cli_state *cli, char *filename,
|
||||
}
|
||||
old->dacl->num_aces--;
|
||||
if (old->dacl->num_aces == 0) {
|
||||
free(old->dacl->ace);
|
||||
old->dacl->ace=NULL;
|
||||
free(old->dacl);
|
||||
old->dacl = NULL;
|
||||
SAFE_FREE(old->dacl->ace);
|
||||
SAFE_FREE(old->dacl);
|
||||
old->off_dacl = 0;
|
||||
}
|
||||
found = True;
|
||||
@ -713,14 +711,14 @@ struct cli_state *connect_one(char *share)
|
||||
if (!(c=cli_initialise(NULL)) || !cli_connect(c, server, &ip)) {
|
||||
DEBUG(0,("Connection to %s failed\n", server));
|
||||
cli_shutdown(c);
|
||||
safe_free(c);
|
||||
SAFE_FREE(c);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!cli_session_request(c, &calling, &called)) {
|
||||
DEBUG(0,("session request to %s failed\n", called.name));
|
||||
cli_shutdown(c);
|
||||
safe_free(c);
|
||||
SAFE_FREE(c);
|
||||
if (strcmp(called.name, "*SMBSERVER")) {
|
||||
make_nmb_name(&called , "*SMBSERVER", 0x20);
|
||||
goto again;
|
||||
@ -733,7 +731,7 @@ struct cli_state *connect_one(char *share)
|
||||
if (!cli_negprot(c)) {
|
||||
DEBUG(0,("protocol negotiation failed\n"));
|
||||
cli_shutdown(c);
|
||||
safe_free(c);
|
||||
SAFE_FREE(c);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -750,7 +748,7 @@ struct cli_state *connect_one(char *share)
|
||||
lp_workgroup())) {
|
||||
DEBUG(0,("session setup failed: %s\n", cli_errstr(c)));
|
||||
cli_shutdown(c);
|
||||
safe_free(c);
|
||||
SAFE_FREE(c);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -760,7 +758,7 @@ struct cli_state *connect_one(char *share)
|
||||
password, strlen(password)+1)) {
|
||||
DEBUG(0,("tree connect failed: %s\n", cli_errstr(c)));
|
||||
cli_shutdown(c);
|
||||
safe_free(c);
|
||||
SAFE_FREE(c);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -491,14 +491,14 @@ static char *prompt_for_new_password(BOOL stdin_get)
|
||||
p = get_pass("New SMB password:", stdin_get);
|
||||
|
||||
fstrcpy(new_passwd, p);
|
||||
safe_free(p);
|
||||
SAFE_FREE(p);
|
||||
|
||||
p = get_pass("Retype new SMB password:", stdin_get);
|
||||
|
||||
if (strcmp(p, new_passwd)) {
|
||||
fprintf(stderr, "Mismatch - password unchanged.\n");
|
||||
ZERO_ARRAY(new_passwd);
|
||||
safe_free(p);
|
||||
SAFE_FREE(p);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -730,7 +730,7 @@ static int process_root(int argc, char *argv[])
|
||||
}
|
||||
|
||||
if (local_flags & LOCAL_ADD_USER) {
|
||||
safe_free(new_passwd);
|
||||
SAFE_FREE(new_passwd);
|
||||
new_passwd = xstrdup(user_name);
|
||||
strlower(new_passwd);
|
||||
}
|
||||
@ -803,7 +803,7 @@ static int process_root(int argc, char *argv[])
|
||||
}
|
||||
|
||||
done:
|
||||
safe_free(new_passwd);
|
||||
SAFE_FREE(new_passwd);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -898,8 +898,8 @@ static int process_nonroot(int argc, char *argv[])
|
||||
printf("Password changed for user %s\n", user_name);
|
||||
|
||||
done:
|
||||
safe_free(old_passwd);
|
||||
safe_free(new_passwd);
|
||||
SAFE_FREE(old_passwd);
|
||||
SAFE_FREE(new_passwd);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ static struct cli_state *get_ipc_connect(char *server,
|
||||
if (cli && cli->initialised)
|
||||
cli_shutdown(cli);
|
||||
|
||||
free(cli);
|
||||
SAFE_FREE(cli);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ void cgi_load_variables(FILE *f1)
|
||||
variables[num_variables].name = strdup(line);
|
||||
variables[num_variables].value = strdup(p+1);
|
||||
|
||||
free(line);
|
||||
SAFE_FREE(line);
|
||||
|
||||
if (!variables[num_variables].name ||
|
||||
!variables[num_variables].value)
|
||||
|
@ -36,7 +36,7 @@ BOOL nmbd_running(void)
|
||||
if ((ip_list = name_query(fd, "__SAMBA__", 0,
|
||||
True, True, loopback_ip,
|
||||
&count)) != NULL) {
|
||||
free(ip_list);
|
||||
SAFE_FREE(ip_list);
|
||||
close(fd);
|
||||
return True;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user