diff options
author | Gregor Beck <gbeck@sernet.de> | 2012-06-29 11:36:54 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2012-06-29 15:21:23 +0200 |
commit | fef41956b9308482a2496827851d47f54dc4873b (patch) | |
tree | 6422a6a38544ba66c2215cb5362eb47d5220f287 /source3 | |
parent | 9e53a0209b3c8e4523f39ac92ba86ac42376e204 (diff) | |
download | samba-fef41956b9308482a2496827851d47f54dc4873b.tar.gz samba-fef41956b9308482a2496827851d47f54dc4873b.tar.bz2 samba-fef41956b9308482a2496827851d47f54dc4873b.zip |
s3:cclean: fix memory allocation
Signed-off-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/utils/cclean.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source3/utils/cclean.c b/source3/utils/cclean.c index b035d33c03..d98725e7fb 100644 --- a/source3/utils/cclean.c +++ b/source3/utils/cclean.c @@ -66,7 +66,7 @@ static int read_connections_fn(const struct connections_key *key, struct cclean_ctx *ctx = (struct cclean_ctx *)cclean_ctx; unsigned length = talloc_array_length(ctx->cnums); if (length <= ctx->num) { - int n = 2*length; + int n = MAX(2*length, 16); void *tmp; tmp = talloc_realloc(ctx, ctx->ids, struct server_id, n); @@ -95,7 +95,7 @@ static int read_connections_fn(const struct connections_key *key, ctx->ids[ctx->num] = key->pid; ctx->cnums[ctx->num] = key->cnum; ctx->names[ctx->num] = talloc_strndup(ctx, key->name, FSTRING_LEN); - if (ctx->names[ctx->num]) { + if (ctx->names[ctx->num] == NULL) { goto talloc_failed; } ctx->num++; |