net: Avoid tallocs
authorVolker Lendecke <vl@samba.org>
Fri, 30 Mar 2018 14:16:47 +0000 (09:16 -0500)
committerJeremy Allison <jra@samba.org>
Tue, 3 Apr 2018 22:44:23 +0000 (00:44 +0200)
Not really performance critical, but I think it's worth establishing sample
code to use more stack variables than going out to talloc.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/utils/net_cache.c

index 98c5803c42856593ebf1bb416fe55d3881a1ac40..f9d12ef4945c5fa903e3ba655c7e8666da7fad45 100644 (file)
@@ -462,8 +462,9 @@ static int net_cache_samlogon_show(struct net_context *c,
        }
 
        for (i = 0; i < num_user_sids; i++) {
-               d_printf("SID %2" PRIu32 ": %s\n",
-                        i, sid_string_dbg(&user_sids[i]));
+               char buf[DOM_SID_STR_BUFLEN];
+               dom_sid_string_buf(&user_sids[i], buf, sizeof(buf));
+               d_printf("SID %2" PRIu32 ": %s\n", i, buf);
        }
 
        TALLOC_FREE(user_sids);