diff options
author | Alexander Bokovoy <ab@samba.org> | 2006-12-18 17:55:48 +0300 |
---|---|---|
committer | Alexander Bokovoy <ab@samba.org> | 2006-12-18 17:55:48 +0300 |
commit | 1d8c33e2a17617baacfdea626b5fc7c036d85548 (patch) | |
tree | 8808be88351e59849c1ce2fde921f39111023816 /ctdb/common | |
parent | ee547a0f9aa1642110f4740eaecd552b7ea63539 (diff) | |
download | samba-1d8c33e2a17617baacfdea626b5fc7c036d85548.tar.gz samba-1d8c33e2a17617baacfdea626b5fc7c036d85548.tar.xz samba-1d8c33e2a17617baacfdea626b5fc7c036d85548.zip |
Fix memory handling
(This used to be ctdb commit a7ff834cec4c44eee7d1a84218e050a45b94d599)
Diffstat (limited to 'ctdb/common')
-rw-r--r-- | ctdb/common/ctdb_ltdb.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ctdb/common/ctdb_ltdb.c b/ctdb/common/ctdb_ltdb.c index 881cf48630..8958140002 100644 --- a/ctdb/common/ctdb_ltdb.c +++ b/ctdb/common/ctdb_ltdb.c @@ -79,6 +79,7 @@ int ctdb_ltdb_fetch(struct ctdb_context *ctdb, if (rec.dsize < sizeof(*header)) { /* return an initial header */ ltdb_initial_header(ctdb, key, header); + SAFE_FREE(rec.dptr); data->dptr = NULL; data->dsize = 0; return 0; @@ -89,6 +90,7 @@ int ctdb_ltdb_fetch(struct ctdb_context *ctdb, data->dsize = rec.dsize - sizeof(struct ctdb_ltdb_header); data->dptr = talloc_memdup(ctdb, sizeof(struct ctdb_ltdb_header)+rec.dptr, data->dsize); + SAFE_FREE(rec.dptr); CTDB_NO_MEMORY(ctdb, data->dptr); return 0; @@ -106,7 +108,7 @@ int ctdb_ltdb_store(struct ctdb_context *ctdb, TDB_DATA key, TDB_DATA rec; int ret; - rec.dsize = sizeof(struct ctdb_ltdb_header) + data.dsize; + rec.dsize = sizeof(*header) + data.dsize; rec.dptr = talloc_size(ctdb, rec.dsize); CTDB_NO_MEMORY(ctdb, rec.dptr); |