From: Stefan Metzmacher Date: Thu, 13 Nov 2008 20:26:03 +0000 (+0100) Subject: lib/util: hex_encode_talloc(): fix error path and set talloc name X-Git-Tag: samba-4.0.0alpha6~480^2~209^2~40 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=64b6d2d3e3bddd51a792c2ea9a4bdbcfcc5f0666;p=thirdparty%2Fsamba.git lib/util: hex_encode_talloc(): fix error path and set talloc name metze --- diff --git a/lib/util/util.c b/lib/util/util.c index 4e2a5aab098..7548d30b7ef 100644 --- a/lib/util/util.c +++ b/lib/util/util.c @@ -701,10 +701,14 @@ _PUBLIC_ char *hex_encode_talloc(TALLOC_CTX *mem_ctx, const unsigned char *buff_ char *hex_buffer; hex_buffer = talloc_array(mem_ctx, char, (len*2)+1); + if (!hex_buffer) { + return NULL; + } for (i = 0; i < len; i++) slprintf(&hex_buffer[i*2], 3, "%02X", buff_in[i]); + talloc_set_name_const(hex_buffer, hex_buffer); return hex_buffer; }