diff options
author | Andreas Schneider <asn@samba.org> | 2018-09-26 14:29:50 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2018-10-19 23:11:26 +0200 |
commit | 2679dd0fd87903822f7ed29cfb88834838e69346 (patch) | |
tree | 7b769e02936135ed60f12e7343198917ed15ceec /source3/registry | |
parent | 9e03fb60dca0ebafa8bf8095d6e21659bdf453ee (diff) | |
download | samba-2679dd0fd87903822f7ed29cfb88834838e69346.tar.gz |
s3:registry: Avoid a double-free in reg_perfcount
Found by covscan.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/registry')
-rw-r--r-- | source3/registry/reg_perfcount.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source3/registry/reg_perfcount.c b/source3/registry/reg_perfcount.c index 6fa96f314fb..394930b27a9 100644 --- a/source3/registry/reg_perfcount.c +++ b/source3/registry/reg_perfcount.c @@ -186,9 +186,9 @@ static uint32_t _reg_perfcount_multi_sz_from_tdb(TDB_CONTEXT *tdb, } /* First encode the name_index */ working_size = (kbuf.dsize + 1)*sizeof(uint16_t); + /* SMB_REALLOC frees buf1 on error */ p = (char *)SMB_REALLOC(buf1, buffer_size + working_size); if (p == NULL) { - SAFE_FREE(buf1); buffer_size = 0; return buffer_size; } @@ -203,9 +203,9 @@ static uint32_t _reg_perfcount_multi_sz_from_tdb(TDB_CONTEXT *tdb, buffer_size += working_size; /* Now encode the actual name */ working_size = (dbuf.dsize + 1)*sizeof(uint16_t); + /* SMB_REALLOC frees buf1 on error */ p = (char *)SMB_REALLOC(buf1, buffer_size + working_size); if (p == NULL) { - SAFE_FREE(buf1); buffer_size = 0; return buffer_size; } |