make_nmb_name(&calling, myname, 0x0);
make_nmb_name(&called , host, 0x20);
- zero_addr(&ss);
+ zero_sockaddr(&ss);
if (!(c = cli_initialise())) {
printf("Failed initialize cli_struct to connect with %s\n", host);
return True;
}
-void torture_open_connection_free_unclist(char **unc_list)
-{
- if (unc_list!=NULL)
- {
- SAFE_FREE(unc_list[0]);
- SAFE_FREE(unc_list);
- }
-}
-
bool torture_open_connection(struct cli_state **c, int conn_index)
{
char **unc_list = NULL;
if (use_multishare_conn==True) {
char *h, *s;
- unc_list = file_lines_load(multishare_conn_fname, &num_unc_names, 0);
+ unc_list = file_lines_load(multishare_conn_fname, &num_unc_names, 0, NULL);
if (!unc_list || num_unc_names <= 0) {
printf("Failed to load unc names list from '%s'\n", multishare_conn_fname);
exit(1);
NULL, &h, &s)) {
printf("Failed to parse UNC name %s\n",
unc_list[conn_index % num_unc_names]);
- torture_open_connection_free_unclist(unc_list);
+ TALLOC_FREE(unc_list);
exit(1);
}
result = torture_open_connection_share(c, h, s);
/* h, s were copied earlier */
- torture_open_connection_free_unclist(unc_list);
+ TALLOC_FREE(unc_list);
return result;
}
return False;
}
- blob = data_blob_string_const("bar");
+ blob = data_blob_string_const_null("bar");
tm = time(NULL);
if (!gencache_set_data_blob("foo", &blob, tm)) {
DATA_BLOB d1, d2, d3;
DATA_BLOB v1, v2, v3;
+ TALLOC_CTX *mem_ctx;
+ char *str1, *str2;
+ size_t size1, size2;
+ bool ret = false;
+
cache = memcache_init(NULL, 100);
if (cache == NULL) {
}
TALLOC_FREE(cache);
- return true;
+
+ cache = memcache_init(NULL, 0);
+
+ mem_ctx = talloc_init("foo");
+
+ str1 = talloc_strdup(mem_ctx, "string1");
+ str2 = talloc_strdup(mem_ctx, "string2");
+
+ memcache_add_talloc(cache, SINGLETON_CACHE_TALLOC,
+ data_blob_string_const("torture"), &str1);
+ size1 = talloc_total_size(cache);
+
+ memcache_add_talloc(cache, SINGLETON_CACHE_TALLOC,
+ data_blob_string_const("torture"), &str2);
+ size2 = talloc_total_size(cache);
+
+ printf("size1=%d, size2=%d\n", (int)size1, (int)size2);
+
+ if (size2 > size1) {
+ printf("memcache leaks memory!\n");
+ goto fail;
+ }
+
+ ret = true;
+ fail:
+ TALLOC_FREE(cache);
+ return ret;
}
static double create_procs(bool (*fn)(int), bool *result)
*p = 0;
fstrcpy(share, p+1);
- fstrcpy(myname, get_myname(talloc_tos()));
+ fstrcpy(myname, talloc_get_myname(talloc_tos()));
if (!*myname) {
fprintf(stderr, "Failed to get my hostname.\n");
return 1;