mirror of
https://github.com/samba-team/samba.git
synced 2025-09-02 01:49:29 +03:00
Remove silly safe_free() function which is a wrapper around SAFE_FREE().
Since it's a function it just sets the local pointer to NULL and basically is an equivalent to free(). It also claims it's being used for callbacks but isn't used that way anywhere.
This commit is contained in:
@ -1227,17 +1227,6 @@ void add_to_large_array(TALLOC_CTX *mem_ctx, size_t element_size,
|
|||||||
*array_size = -1;
|
*array_size = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
Free memory, checks for NULL.
|
|
||||||
Use directly SAFE_FREE()
|
|
||||||
Exists only because we need to pass a function pointer somewhere --SSS
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
void safe_free(void *p)
|
|
||||||
{
|
|
||||||
SAFE_FREE(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
Get my own name and IP.
|
Get my own name and IP.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -280,7 +280,7 @@ static bool upgrade_to_version_3(void)
|
|||||||
DEBUG(0,("upgrade_to_version_3: upgrading print tdb's to version 3\n"));
|
DEBUG(0,("upgrade_to_version_3: upgrading print tdb's to version 3\n"));
|
||||||
|
|
||||||
for (kbuf = tdb_firstkey(tdb_drivers); kbuf.dptr;
|
for (kbuf = tdb_firstkey(tdb_drivers); kbuf.dptr;
|
||||||
newkey = tdb_nextkey(tdb_drivers, kbuf), safe_free(kbuf.dptr), kbuf=newkey) {
|
newkey = tdb_nextkey(tdb_drivers, kbuf), free(kbuf.dptr), kbuf=newkey) {
|
||||||
|
|
||||||
dbuf = tdb_fetch(tdb_drivers, kbuf);
|
dbuf = tdb_fetch(tdb_drivers, kbuf);
|
||||||
|
|
||||||
@ -807,7 +807,7 @@ int get_ntforms(nt_forms_struct **list)
|
|||||||
|
|
||||||
for (kbuf = tdb_firstkey(tdb_forms);
|
for (kbuf = tdb_firstkey(tdb_forms);
|
||||||
kbuf.dptr;
|
kbuf.dptr;
|
||||||
newkey = tdb_nextkey(tdb_forms, kbuf), safe_free(kbuf.dptr), kbuf=newkey)
|
newkey = tdb_nextkey(tdb_forms, kbuf), free(kbuf.dptr), kbuf=newkey)
|
||||||
{
|
{
|
||||||
if (strncmp((const char *)kbuf.dptr, FORMS_PREFIX, strlen(FORMS_PREFIX)) != 0)
|
if (strncmp((const char *)kbuf.dptr, FORMS_PREFIX, strlen(FORMS_PREFIX)) != 0)
|
||||||
continue;
|
continue;
|
||||||
@ -1024,7 +1024,7 @@ int get_ntdrivers(fstring **list, const char *architecture, uint32 version)
|
|||||||
|
|
||||||
for (kbuf = tdb_firstkey(tdb_drivers);
|
for (kbuf = tdb_firstkey(tdb_drivers);
|
||||||
kbuf.dptr;
|
kbuf.dptr;
|
||||||
newkey = tdb_nextkey(tdb_drivers, kbuf), safe_free(kbuf.dptr), kbuf=newkey) {
|
newkey = tdb_nextkey(tdb_drivers, kbuf), free(kbuf.dptr), kbuf=newkey) {
|
||||||
|
|
||||||
if (strncmp((const char *)kbuf.dptr, key, strlen(key)) != 0)
|
if (strncmp((const char *)kbuf.dptr, key, strlen(key)) != 0)
|
||||||
continue;
|
continue;
|
||||||
@ -3123,8 +3123,7 @@ static void map_single_multi_sz_into_ctr(REGVAL_CTR *ctr, const char *val_name,
|
|||||||
regval_ctr_delvalue(ctr, val_name);
|
regval_ctr_delvalue(ctr, val_name);
|
||||||
regval_ctr_addvalue(ctr, val_name, REG_MULTI_SZ,
|
regval_ctr_addvalue(ctr, val_name, REG_MULTI_SZ,
|
||||||
(char *) conv_strs, str_size);
|
(char *) conv_strs, str_size);
|
||||||
safe_free(conv_strs);
|
SAFE_FREE(conv_strs);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -179,7 +179,7 @@ void pcap_cache_reload(void)
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; (pcap_line = fgets_slash(NULL, 1024, pcap_file)) != NULL; safe_free(pcap_line)) {
|
for (; (pcap_line = fgets_slash(NULL, 1024, pcap_file)) != NULL; free(pcap_line)) {
|
||||||
char name[MAXPRINTERLEN+1];
|
char name[MAXPRINTERLEN+1];
|
||||||
char comment[62];
|
char comment[62];
|
||||||
char *p, *q;
|
char *p, *q;
|
||||||
|
@ -49,7 +49,7 @@ bool aix_cache_reload(void)
|
|||||||
|
|
||||||
iEtat = 0;
|
iEtat = 0;
|
||||||
/* scan qconfig file for searching <printername>: */
|
/* scan qconfig file for searching <printername>: */
|
||||||
for (;(line = fgets_slash(NULL, 1024, pfile)); safe_free(line)) {
|
for (;(line = fgets_slash(NULL, 1024, pfile)); free(line)) {
|
||||||
if (*line == '*' || *line == 0)
|
if (*line == '*' || *line == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ bool aix_cache_reload(void)
|
|||||||
if (strcmp(p, "bsh") != 0) {
|
if (strcmp(p, "bsh") != 0) {
|
||||||
name = talloc_strdup(ctx, p);
|
name = talloc_strdup(ctx, p);
|
||||||
if (!name) {
|
if (!name) {
|
||||||
safe_free(line);
|
SAFE_FREE(line);
|
||||||
x_fclose(pfile);
|
x_fclose(pfile);
|
||||||
TALLOC_FREE(ctx);
|
TALLOC_FREE(ctx);
|
||||||
return false;
|
return false;
|
||||||
@ -85,7 +85,7 @@ bool aix_cache_reload(void)
|
|||||||
/* probably a good printer ??? */
|
/* probably a good printer ??? */
|
||||||
iEtat = 0;
|
iEtat = 0;
|
||||||
if (!pcap_cache_add(name, NULL)) {
|
if (!pcap_cache_add(name, NULL)) {
|
||||||
safe_free(line);
|
SAFE_FREE(line);
|
||||||
x_fclose(pfile);
|
x_fclose(pfile);
|
||||||
TALLOC_FREE(ctx);
|
TALLOC_FREE(ctx);
|
||||||
return false;
|
return false;
|
||||||
@ -100,7 +100,7 @@ bool aix_cache_reload(void)
|
|||||||
/* it's a good virtual printer */
|
/* it's a good virtual printer */
|
||||||
iEtat = 0;
|
iEtat = 0;
|
||||||
if (!pcap_cache_add(name, NULL)) {
|
if (!pcap_cache_add(name, NULL)) {
|
||||||
safe_free(line);
|
SAFE_FREE(line);
|
||||||
x_fclose(pfile);
|
x_fclose(pfile);
|
||||||
TALLOC_FREE(ctx);
|
TALLOC_FREE(ctx);
|
||||||
return false;
|
return false;
|
||||||
|
@ -480,7 +480,7 @@ static int ads_user_add(struct net_context *c, int argc, const char **argv)
|
|||||||
asprintf(&upn, "%s@%s", argv[0], ads->config.realm);
|
asprintf(&upn, "%s@%s", argv[0], ads->config.realm);
|
||||||
status = ads_krb5_set_password(ads->auth.kdc_server, upn, argv[1],
|
status = ads_krb5_set_password(ads->auth.kdc_server, upn, argv[1],
|
||||||
ads->auth.time_offset);
|
ads->auth.time_offset);
|
||||||
safe_free(upn);
|
SAFE_FREE(upn);
|
||||||
if (ADS_ERR_OK(status)) {
|
if (ADS_ERR_OK(status)) {
|
||||||
d_printf("User %s added\n", argv[0]);
|
d_printf("User %s added\n", argv[0]);
|
||||||
rc = 0;
|
rc = 0;
|
||||||
@ -534,7 +534,7 @@ static int ads_user_info(struct net_context *c, int argc, const char **argv)
|
|||||||
|
|
||||||
asprintf(&searchstring, "(sAMAccountName=%s)", escaped_user);
|
asprintf(&searchstring, "(sAMAccountName=%s)", escaped_user);
|
||||||
rc = ads_search(ads, &res, searchstring, attrs);
|
rc = ads_search(ads, &res, searchstring, attrs);
|
||||||
safe_free(searchstring);
|
SAFE_FREE(searchstring);
|
||||||
|
|
||||||
if (!ADS_ERR_OK(rc)) {
|
if (!ADS_ERR_OK(rc)) {
|
||||||
d_fprintf(stderr, "ads_search: %s\n", ads_errstr(rc));
|
d_fprintf(stderr, "ads_search: %s\n", ads_errstr(rc));
|
||||||
|
@ -2482,7 +2482,7 @@ NTSTATUS rpc_printer_migrate_settings_internals(struct net_context *c,
|
|||||||
TALLOC_FREE( reg_ctr );
|
TALLOC_FREE( reg_ctr );
|
||||||
}
|
}
|
||||||
|
|
||||||
safe_free(keylist);
|
SAFE_FREE(keylist);
|
||||||
|
|
||||||
/* close printer handles here */
|
/* close printer handles here */
|
||||||
if (got_hnd_src) {
|
if (got_hnd_src) {
|
||||||
|
@ -219,7 +219,7 @@ static bool query_one(const char *lookup, unsigned int lookup_type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
safe_free(ip_list);
|
free(ip_list);
|
||||||
|
|
||||||
return (ip_list != NULL);
|
return (ip_list != NULL);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user