The Samba-Bugzilla – Attachment 9566 Details for
Bug 10367
Fix several memory leaks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
v4-1-test patch
look (text/plain), 5.22 KB, created by
Andreas Schneider
on 2014-01-10 15:56:13 UTC
(
hide
)
Description:
v4-1-test patch
Filename:
MIME Type:
Creator:
Andreas Schneider
Created:
2014-01-10 15:56:13 UTC
Size:
5.22 KB
patch
obsolete
>From d790112e74b684a516152e301d5a46c178bf437c Mon Sep 17 00:00:00 2001 >From: Andreas Schneider <asn@samba.org> >Date: Thu, 9 Jan 2014 14:50:18 +0100 >Subject: [PATCH 1/4] lib: Fix strict-aliasing warning in md5 code. >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >If the compiler detects strict aliasing problems it isn't able to >optimize the code. > >Signed-off-by: Andreas Schneider <asn@samba.org> >Reviewed-by: Günther Deschner <gd@samba.org> >(cherry picked from commit 615efa4ae84373ae8aefb36fcf7583338665429a) >--- > lib/crypto/md5.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > >diff --git a/lib/crypto/md5.c b/lib/crypto/md5.c >index b834c91..352f80f 100644 >--- a/lib/crypto/md5.c >+++ b/lib/crypto/md5.c >@@ -137,9 +137,12 @@ _PUBLIC_ void MD5Final(uint8_t digest[16], MD5_CTX *ctx) > } > byteReverse(ctx->in, 14); > >- /* Append length in bits and transform */ >- ((uint32_t *) ctx->in)[14] = ctx->bits[0]; >- ((uint32_t *) ctx->in)[15] = ctx->bits[1]; >+ /* Append length in bits and transform. >+ * Use memcpy to avoid strict-aliasing problems. >+ * This way it can be optimized. >+ */ >+ memcpy(&ctx->in[14 * sizeof(uint32_t)], &ctx->bits[0], sizeof(uint32_t)); >+ memcpy(&ctx->in[15 * sizeof(uint32_t)], &ctx->bits[1], sizeof(uint32_t)); > > MD5Transform(ctx->buf, (uint32_t *) ctx->in); > byteReverse((uint8_t *) ctx->buf, 4); >-- >1.8.5.2 > > >From 38bae403ce6a8efaee5704328b47ec5b8300b5ed Mon Sep 17 00:00:00 2001 >From: Andreas Schneider <asn@samba.org> >Date: Thu, 9 Jan 2014 15:06:14 +0100 >Subject: [PATCH 2/4] s3-libads: Fix memory leaks in ads_build_path(). >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Signed-off-by: Andreas Schneider <asn@samba.org> >Reviewed-by: Günther Deschner <gd@samba.org> >(cherry picked from commit c8371b4ec12f2dea6ce18724de59a23e04826c1d) >--- > source3/libads/ads_struct.c | 2 ++ > 1 file changed, 2 insertions(+) > >diff --git a/source3/libads/ads_struct.c b/source3/libads/ads_struct.c >index fd7e417..30d433e 100644 >--- a/source3/libads/ads_struct.c >+++ b/source3/libads/ads_struct.c >@@ -55,12 +55,14 @@ char *ads_build_path(const char *realm, const char *sep, const char *field, int > if (strlcpy(ret,field, len) >= len) { > /* Truncate ! */ > free(r); >+ free(ret); > return NULL; > } > p=strtok_r(r, sep, &saveptr); > if (p) { > if (strlcat(ret, p, len) >= len) { > free(r); >+ free(ret); > return NULL; > } > >-- >1.8.5.2 > > >From 37eb6566dd18958cbe2f216aa9880e9455939426 Mon Sep 17 00:00:00 2001 >From: Andreas Schneider <asn@samba.org> >Date: Thu, 9 Jan 2014 15:12:24 +0100 >Subject: [PATCH 3/4] wbinfo: Fix a memory leak in wbinfo_ping_dc(). >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Signed-off-by: Andreas Schneider <asn@samba.org> >Reviewed-by: Günther Deschner <gd@samba.org> >(cherry picked from commit 541164d47a86bab90ef96a9be40b8c0997abdd61) >--- > nsswitch/wbinfo.c | 1 + > 1 file changed, 1 insertion(+) > >diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c >index 3f0310a..0a5ec40 100644 >--- a/nsswitch/wbinfo.c >+++ b/nsswitch/wbinfo.c >@@ -838,6 +838,7 @@ static bool wbinfo_ping_dc(void) > dcname ? dcname : "", > WBC_ERROR_IS_OK(wbc_status) ? "succeeded" : "failed"); > >+ wbcFreeMemory(dcname); > if (wbc_status == WBC_ERR_AUTH_ERROR) { > d_fprintf(stderr, "error code was %s (0x%x)\n", > error->nt_string, error->nt_status); >-- >1.8.5.2 > > >From f203bfbd91a695f582a6c7ea2fae2c8f3c6825c9 Mon Sep 17 00:00:00 2001 >From: Andreas Schneider <asn@samba.org> >Date: Thu, 9 Jan 2014 15:20:21 +0100 >Subject: [PATCH 4/4] s3-passdb: Fix string duplication to pointers. >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Signed-off-by: Andreas Schneider <asn@samba.org> >Reviewed-by: Günther Deschner <gd@samba.org> > >Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> >Autobuild-Date(master): Thu Jan 9 22:35:25 CET 2014 on sn-devel-104 > >(cherry picked from commit bff3ac250e9d4e7d91820eb53c28257aa38fff88) >--- > source3/passdb/py_passdb.c | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > >diff --git a/source3/passdb/py_passdb.c b/source3/passdb/py_passdb.c >index 3fd14cd..e1df75b 100644 >--- a/source3/passdb/py_passdb.c >+++ b/source3/passdb/py_passdb.c >@@ -2269,8 +2269,18 @@ static PyObject *py_pdb_set_aliasinfo(pytalloc_Object *self, PyObject *args) > > alias_sid = pytalloc_get_ptr(py_alias_sid); > >- fstrcpy(alias_info.acct_name, PyString_AsString(PyDict_GetItemString(py_alias_info, "acct_name"))); >- fstrcpy(alias_info.acct_desc, PyString_AsString(PyDict_GetItemString(py_alias_info, "acct_desc"))); >+ alias_info.acct_name = talloc_strdup(frame, PyString_AsString(PyDict_GetItemString(py_alias_info, "acct_name"))); >+ if (alias_info.acct_name == NULL) { >+ PyErr_Format(py_pdb_error, "Unable to allocate memory"); >+ talloc_free(frame); >+ return NULL; >+ } >+ alias_info.acct_desc = talloc_strdup(frame, PyString_AsString(PyDict_GetItemString(py_alias_info, "acct_desc"))); >+ if (alias_info.acct_desc == NULL) { >+ PyErr_Format(py_pdb_error, "Unable to allocate memory"); >+ talloc_free(frame); >+ return NULL; >+ } > > status = methods->set_aliasinfo(methods, alias_sid, &alias_info); > if (!NT_STATUS_IS_OK(status)) { >-- >1.8.5.2 >
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:
gd
:
review+
Actions:
View
Attachments on
bug 10367
: 9566