The Samba-Bugzilla – Attachment 16421 Details for
Bug 14625
smbd share mode double free crash
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
possible fix
0001-lib-util-Avoid-free-ing-our-own-pointer.patch (text/plain), 1.51 KB, created by
Andreas Schneider
on 2021-02-02 17:15:48 UTC
(
hide
)
Description:
possible fix
Filename:
MIME Type:
Creator:
Andreas Schneider
Created:
2021-02-02 17:15:48 UTC
Size:
1.51 KB
patch
obsolete
>From fa0012ac341913c7085aca89b941bce49e368a17 Mon Sep 17 00:00:00 2001 >From: Andreas Schneider <asn@samba.org> >Date: Tue, 2 Feb 2021 18:10:38 +0100 >Subject: [PATCH] lib:util: Avoid free'ing our own pointer > >Signed-off-by: Andreas Schneider <asn@samba.org> >--- > lib/util/memcache.c | 16 ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > >diff --git a/lib/util/memcache.c b/lib/util/memcache.c >index 1e616bd0e9a..7c0ba8d6af0 100644 >--- a/lib/util/memcache.c >+++ b/lib/util/memcache.c >@@ -223,14 +223,26 @@ static void memcache_delete_element(struct memcache *cache, > TALLOC_FREE(e); > } > >-static void memcache_trim(struct memcache *cache) >+static void memcache_trim(struct memcache *cache, struct memcache_element *e) > { >+ struct memcache_element *tail = NULL; >+ > if (cache->max_size == 0) { > return; > } > > while ((cache->size > cache->max_size) && DLIST_TAIL(cache->mru)) { > memcache_delete_element(cache, DLIST_TAIL(cache->mru)); >+ for (tail = DLIST_TAIL(cache->mru); >+ (cache->size > cache->max_size) && (tail != NULL); >+ tail = DLIST_TAIL(cache->mru)) { >+ if (tail == e) { >+ tail = DLIST_PREV(tail); >+ if (tail == NULL) { >+ break; >+ } >+ } >+ memcache_delete_element(cache, tail); > } > } > >@@ -351,7 +363,7 @@ void memcache_add(struct memcache *cache, enum memcache_number n, > memcpy(&mtv, cache_value.data, sizeof(mtv)); > cache->size += mtv.len; > } >- memcache_trim(cache); >+ memcache_trim(cache, e); > } > > void memcache_add_talloc(struct memcache *cache, enum memcache_number n, >-- >2.30.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
asn
:
review+
slow
:
review+
Actions:
View
Attachments on
bug 14625
:
16418
| 16421 |
16427
|
16428
|
16429