diff options
author | Volker Lendecke <vl@samba.org> | 2008-05-19 15:53:09 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2008-05-19 15:59:54 +0200 |
commit | d817b435342956295f0a31b91203d1a63ae12063 (patch) | |
tree | 564506c84bddd0861a51ba0d7290906f2cb1bc92 | |
parent | eb1b76d200ea38fd1cea367016b782776004964c (diff) | |
download | samba-d817b435342956295f0a31b91203d1a63ae12063.tar.gz samba-d817b435342956295f0a31b91203d1a63ae12063.tar.bz2 samba-d817b435342956295f0a31b91203d1a63ae12063.zip |
Fix a memleak in irpc_remove_name
First, even when length==0 tdb_fetch might return something. Second, for some
weird reason there might be less data than necessary for a single server id.
(This used to be commit 49b04ca7aadf264e500d83bc8d3cb5173a86184e)
-rw-r--r-- | source4/lib/messaging/messaging.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index 19284461ee..e7b654894f 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -1085,8 +1085,14 @@ void irpc_remove_name(struct messaging_context *msg_ctx, const char *name) return; } rec = tdb_fetch_bystring(t->tdb, name); + if (rec.dptr == NULL) { + tdb_unlock_bystring(t->tdb, name); + talloc_free(t); + return; + } count = rec.dsize / sizeof(struct server_id); if (count == 0) { + free(rec.dptr); tdb_unlock_bystring(t->tdb, name); talloc_free(t); return; |