diff options
author | Gerald Carter <jerry@samba.org> | 2006-02-20 17:59:58 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:10:14 -0500 |
commit | fb5362c069b5b6548478b2217a0519c56d856705 (patch) | |
tree | 11c9ed652475e840dd24e8fc46c7942a322acf4b /source3/lib | |
parent | 2cf38b62c5d0169385dd9ddc76d9619c14cbbf13 (diff) | |
download | samba-fb5362c069b5b6548478b2217a0519c56d856705.tar.gz samba-fb5362c069b5b6548478b2217a0519c56d856705.tar.bz2 samba-fb5362c069b5b6548478b2217a0519c56d856705.zip |
r13571: Replace all calls to talloc_free() with thye TALLOC_FREE()
macro which sets the freed pointer to NULL.
(This used to be commit b65be8874a2efe5a4b167448960a4fcf6bd995e2)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/events.c | 4 | ||||
-rw-r--r-- | source3/lib/genrand.c | 2 | ||||
-rw-r--r-- | source3/lib/smbldap_util.c | 4 | ||||
-rw-r--r-- | source3/lib/talloctort.c | 80 | ||||
-rw-r--r-- | source3/lib/username.c | 2 | ||||
-rw-r--r-- | source3/lib/util.c | 4 | ||||
-rw-r--r-- | source3/lib/util_pw.c | 4 | ||||
-rw-r--r-- | source3/lib/util_str.c | 10 |
8 files changed, 55 insertions, 55 deletions
diff --git a/source3/lib/events.c b/source3/lib/events.c index 3670d960aa..133752c78e 100644 --- a/source3/lib/events.c +++ b/source3/lib/events.c @@ -33,8 +33,8 @@ static int timed_event_destructor(void *p) } /**************************************************************************** - Schedule a function for future calling, cancel with talloc_free(). - It's the responsibility of the handler to call talloc_free() on the event + Schedule a function for future calling, cancel with TALLOC_FREE(). + It's the responsibility of the handler to call TALLOC_FREE() on the event handed to it. ****************************************************************************/ diff --git a/source3/lib/genrand.c b/source3/lib/genrand.c index 5b643bf297..1897b86818 100644 --- a/source3/lib/genrand.c +++ b/source3/lib/genrand.c @@ -121,7 +121,7 @@ static int do_reseed(BOOL use_fd, int fd) mdfour(md4_tmp, (unsigned char *)pw->pw_passwd, strlen(pw->pw_passwd)); for (i=0;i<16;i++) seed_inbuf[8+i] ^= md4_tmp[i]; - talloc_free(pw); + TALLOC_FREE(pw); } /* diff --git a/source3/lib/smbldap_util.c b/source3/lib/smbldap_util.c index 7b4cf4d079..64e2a5eae4 100644 --- a/source3/lib/smbldap_util.c +++ b/source3/lib/smbldap_util.c @@ -109,7 +109,7 @@ static NTSTATUS add_new_domain_info(struct smbldap_state *ldap_state, attr_list = get_attr_list( NULL, dominfo_attr_list ); rc = smbldap_search_suffix(ldap_state, filter, attr_list, &result); - talloc_free( attr_list ); + TALLOC_FREE( attr_list ); if (rc != LDAP_SUCCESS) { return NT_STATUS_UNSUCCESSFUL; @@ -217,7 +217,7 @@ NTSTATUS smbldap_search_domain_info(struct smbldap_state *ldap_state, attr_list = get_attr_list( NULL, dominfo_attr_list ); rc = smbldap_search_suffix(ldap_state, filter, attr_list , result); - talloc_free( attr_list ); + TALLOC_FREE( attr_list ); if (rc != LDAP_SUCCESS) { DEBUG(2,("Problem during LDAPsearch: %s\n", ldap_err2string (rc))); diff --git a/source3/lib/talloctort.c b/source3/lib/talloctort.c index 6504203a7a..de5552b5d0 100644 --- a/source3/lib/talloctort.c +++ b/source3/lib/talloctort.c @@ -105,7 +105,7 @@ static BOOL test_ref1(void) CHECK_BLOCKS(r1, 2); printf("Freeing p2\n"); - talloc_free(p2); + TALLOC_FREE(p2); talloc_report_full(root, stdout); CHECK_BLOCKS(p1, 5); @@ -113,13 +113,13 @@ static BOOL test_ref1(void) CHECK_BLOCKS(r1, 1); printf("Freeing p1\n"); - talloc_free(p1); + TALLOC_FREE(p1); talloc_report_full(root, stdout); CHECK_BLOCKS(r1, 1); printf("Freeing r1\n"); - talloc_free(r1); + TALLOC_FREE(r1); talloc_report_full(NULL, stdout); printf("Testing NULL\n"); @@ -131,7 +131,7 @@ static BOOL test_ref1(void) CHECK_SIZE(root, 0); - talloc_free(root); + TALLOC_FREE(root); return True; } @@ -161,7 +161,7 @@ static BOOL test_ref2(void) CHECK_BLOCKS(r1, 2); printf("Freeing ref\n"); - talloc_free(ref); + TALLOC_FREE(ref); talloc_report_full(root, stdout); CHECK_BLOCKS(p1, 5); @@ -169,25 +169,25 @@ static BOOL test_ref2(void) CHECK_BLOCKS(r1, 1); printf("Freeing p2\n"); - talloc_free(p2); + TALLOC_FREE(p2); talloc_report_full(root, stdout); CHECK_BLOCKS(p1, 4); CHECK_BLOCKS(r1, 1); printf("Freeing p1\n"); - talloc_free(p1); + TALLOC_FREE(p1); talloc_report_full(root, stdout); CHECK_BLOCKS(r1, 1); printf("Freeing r1\n"); - talloc_free(r1); + TALLOC_FREE(r1); talloc_report_full(root, stdout); CHECK_SIZE(root, 0); - talloc_free(root); + TALLOC_FREE(root); return True; } @@ -213,19 +213,19 @@ static BOOL test_ref3(void) CHECK_BLOCKS(r1, 1); printf("Freeing p1\n"); - talloc_free(p1); + TALLOC_FREE(p1); talloc_report_full(root, stdout); CHECK_BLOCKS(p2, 2); CHECK_BLOCKS(r1, 1); printf("Freeing p2\n"); - talloc_free(p2); + TALLOC_FREE(p2); talloc_report_full(root, stdout); CHECK_SIZE(root, 0); - talloc_free(root); + TALLOC_FREE(root); return True; } @@ -255,25 +255,25 @@ static BOOL test_ref4(void) CHECK_BLOCKS(r1, 2); printf("Freeing r1\n"); - talloc_free(r1); + TALLOC_FREE(r1); talloc_report_full(root, stdout); CHECK_BLOCKS(p1, 5); CHECK_BLOCKS(p2, 1); printf("Freeing p2\n"); - talloc_free(p2); + TALLOC_FREE(p2); talloc_report_full(root, stdout); CHECK_BLOCKS(p1, 4); printf("Freeing p1\n"); - talloc_free(p1); + TALLOC_FREE(p1); talloc_report_full(root, stdout); CHECK_SIZE(root, 0); - talloc_free(root); + TALLOC_FREE(root); return True; } @@ -312,12 +312,12 @@ static BOOL test_unlink1(void) CHECK_BLOCKS(r1, 1); printf("Freeing p1\n"); - talloc_free(p1); + TALLOC_FREE(p1); talloc_report_full(root, stdout); CHECK_SIZE(root, 0); - talloc_free(root); + TALLOC_FREE(root); return True; } @@ -352,7 +352,7 @@ static BOOL test_misc(void) talloc_increase_ref_count(p1); CHECK_BLOCKS(p1, 1); CHECK_BLOCKS(root, 2); - talloc_free(p1); + TALLOC_FREE(p1); CHECK_BLOCKS(p1, 1); CHECK_BLOCKS(root, 2); talloc_unlink(NULL, p1); @@ -367,7 +367,7 @@ static BOOL test_misc(void) printf("failed: talloc_unlink() of parent should succeed\n"); return False; } - talloc_free(p1); + TALLOC_FREE(p1); CHECK_BLOCKS(p1, 1); CHECK_BLOCKS(root, 2); @@ -388,13 +388,13 @@ static BOOL test_misc(void) CHECK_BLOCKS(root, 3); - if (talloc_free(NULL) != -1) { - printf("talloc_free(NULL) should give -1\n"); + if (TALLOC_FREE(NULL) != -1) { + printf("TALLOC_FREE(NULL) should give -1\n"); return False; } talloc_set_destructor(p1, fail_destructor); - if (talloc_free(p1) != -1) { + if (TALLOC_FREE(p1) != -1) { printf("Failed destructor should cause talloc_free to fail\n"); return False; } @@ -408,7 +408,7 @@ static BOOL test_misc(void) printf("Failed to give zero memory\n"); return False; } - talloc_free(p2); + TALLOC_FREE(p2); if (talloc_strdup(root, NULL) != NULL) { printf("failed: strdup on NULL should give NULL\n"); @@ -435,7 +435,7 @@ static BOOL test_misc(void) } CHECK_BLOCKS(p2, 1); CHECK_BLOCKS(p1, 3); - talloc_free(p2); + TALLOC_FREE(p2); d = talloc_array(p1, double, 0x20000000); if (d) { @@ -449,7 +449,7 @@ static BOOL test_misc(void) return False; } - talloc_free(p1); + TALLOC_FREE(p1); CHECK_BLOCKS(root, 1); p1 = talloc_named(root, 100, "%d bytes", 100); @@ -500,7 +500,7 @@ static BOOL test_misc(void) CHECK_SIZE(root, 0); - talloc_free(root); + TALLOC_FREE(root); CHECK_SIZE(NULL, 0); @@ -564,7 +564,7 @@ static BOOL test_realloc(void) CHECK_BLOCKS(root, 1); CHECK_SIZE(root, 0); - talloc_free(root); + TALLOC_FREE(root); return True; } @@ -609,7 +609,7 @@ static BOOL test_realloc_child(void) el1->list2 = talloc_realloc(el1, el1->list2, struct el2 *, 200); el1->list3 = talloc_realloc(el1, el1->list3, struct el2 *, 300); - talloc_free(root); + TALLOC_FREE(root); return True; } @@ -651,7 +651,7 @@ static BOOL test_type(void) return False; } - talloc_free(root); + TALLOC_FREE(root); return True; } @@ -691,21 +691,21 @@ static BOOL test_steal(void) CHECK_BLOCKS(root, 1); CHECK_SIZE(root, 0); - talloc_free(p1); + TALLOC_FREE(p1); talloc_steal(root, p2); CHECK_BLOCKS(root, 2); CHECK_SIZE(root, 20); - talloc_free(p2); + TALLOC_FREE(p2); CHECK_BLOCKS(root, 1); CHECK_SIZE(root, 0); - talloc_free(root); + TALLOC_FREE(root); p1 = talloc_size(NULL, 3); CHECK_SIZE(NULL, 3); - talloc_free(p1); + TALLOC_FREE(p1); return True; } @@ -731,7 +731,7 @@ static BOOL test_realloc_fn(void) CHECK_BLOCKS(root, 1); CHECK_SIZE(root, 0); - talloc_free(root); + TALLOC_FREE(root); return True; @@ -751,13 +751,13 @@ static BOOL test_unref_reparent(void) c1 = talloc_named_const(p1, 1, "child"); talloc_reference(p2, c1); - talloc_free(p1); + TALLOC_FREE(p1); talloc_unlink(p2, c1); CHECK_SIZE(root, 1); - talloc_free(p2); - talloc_free(root); + TALLOC_FREE(p2); + TALLOC_FREE(root); return True; } @@ -780,13 +780,13 @@ static BOOL test_speed(void) p1 = talloc_size(ctx, count); p2 = talloc_strdup(p1, "foo bar"); p3 = talloc_size(p1, 300); - talloc_free(p1); + TALLOC_FREE(p1); count += 3; } while (timeval_elapsed(&tv) < 5.0); printf("talloc: %.0f ops/sec\n", count/timeval_elapsed(&tv)); - talloc_free(ctx); + TALLOC_FREE(ctx); tv = timeval_current(); count = 0; diff --git a/source3/lib/username.c b/source3/lib/username.c index 52994557f7..3dcf9e18cc 100644 --- a/source3/lib/username.c +++ b/source3/lib/username.c @@ -161,7 +161,7 @@ struct passwd *Get_Pwnam(const char *user) */ if (Get_Pwnam_ret) { - talloc_free(Get_Pwnam_ret); + TALLOC_FREE(Get_Pwnam_ret); } Get_Pwnam_ret = ret; diff --git a/source3/lib/util.c b/source3/lib/util.c index dc57839df3..d4443a6480 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1430,7 +1430,7 @@ const char *uidtoname(uid_t uid) pass = getpwuid_alloc(NULL, uid); if (pass) { fstrcpy(name, pass->pw_name); - talloc_free(pass); + TALLOC_FREE(pass); } else { slprintf(name, sizeof(name) - 1, "%ld",(long int)uid); } @@ -1467,7 +1467,7 @@ uid_t nametouid(const char *name) pass = getpwnam_alloc(NULL, name); if (pass) { u = pass->pw_uid; - talloc_free(pass); + TALLOC_FREE(pass); return u; } diff --git a/source3/lib/util_pw.c b/source3/lib/util_pw.c index e026affb44..e632846312 100644 --- a/source3/lib/util_pw.c +++ b/source3/lib/util_pw.c @@ -55,7 +55,7 @@ static void init_pwnam_cache(void) void flush_pwnam_cache(void) { - talloc_free(pwnam_cache); + TALLOC_FREE(pwnam_cache); pwnam_cache = NULL; init_pwnam_cache(); } @@ -96,7 +96,7 @@ struct passwd *getpwnam_alloc(TALLOC_CTX *mem_ctx, const char *name) i = rand() % PWNAMCACHE_SIZE; if (pwnam_cache[i] != NULL) { - talloc_free(pwnam_cache[i]); + TALLOC_FREE(pwnam_cache[i]); } pwnam_cache[i] = talloc_copy_passwd(pwnam_cache, temp); diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 957ebd57bd..e4aa5dbd51 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -1704,7 +1704,7 @@ static char **str_list_make_internal(TALLOC_CTX *mem_ctx, const char *string, co DEBUG(0,("str_list_make: Unable to allocate memory")); str_list_free(&list); if (mem_ctx) { - talloc_free(s); + TALLOC_FREE(s); } else { SAFE_FREE(s); } @@ -1724,7 +1724,7 @@ static char **str_list_make_internal(TALLOC_CTX *mem_ctx, const char *string, co DEBUG(0,("str_list_make: Unable to allocate memory")); str_list_free(&list); if (mem_ctx) { - talloc_free(s); + TALLOC_FREE(s); } else { SAFE_FREE(s); } @@ -1735,7 +1735,7 @@ static char **str_list_make_internal(TALLOC_CTX *mem_ctx, const char *string, co } if (mem_ctx) { - talloc_free(s); + TALLOC_FREE(s); } else { SAFE_FREE(s); } @@ -1823,13 +1823,13 @@ static void str_list_free_internal(TALLOC_CTX *mem_ctx, char ***list) tlist = *list; for(; *tlist; tlist++) { if (mem_ctx) { - talloc_free(*tlist); + TALLOC_FREE(*tlist); } else { SAFE_FREE(*tlist); } } if (mem_ctx) { - talloc_free(*tlist); + TALLOC_FREE(*tlist); } else { SAFE_FREE(*list); } |