The branch, master has been updated
       via  31158d62e55 lib:ldb:tools: Do not leak memory in 
ldb_cmdline_process_internal()
       via  52dec2b3c89 lib:ldb:tools: Remove trailing spaces in cmdline.c
       via  5f9656e6e10 nsswitch: Fix memory leak in wbinfo_xids_to_sids()
      from  ceb9109c877 lib:replace: Implement setproctitle() based on 
PRCTL_MM_MAP

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 31158d62e55badd9e26291842dace1ffe70157c8
Author: Andreas Schneider <[email protected]>
Date:   Wed Oct 22 09:33:56 2025 +0200

    lib:ldb:tools: Do not leak memory in ldb_cmdline_process_internal()
    
    If add_control() hasn't been called before, it will be NULL. Use ret as
    the context to allocate memory on.
    
    Direct leak of 110 byte(s) in 1 object(s) allocated from:
        #0 0x7fc1b5921c2b in malloc (/lib64/libasan.so.8+0x121c2b) (BuildId: 
388ee9ac193f74c177c6f52988d2d0dab110de41)
        #1 0x7fc1b56ed6a0 in __talloc_with_prefix ../../lib/talloc/talloc.c:783
        #2 0x7fc1b56ee9e8 in __talloc ../../lib/talloc/talloc.c:825
        #3 0x7fc1b56ee9e8 in __talloc_strlendup ../../lib/talloc/talloc.c:2454
        #4 0x7fc1b56ee9e8 in talloc_strdup ../../lib/talloc/talloc.c:2470
        #5 0x7fc1b5f1ad18 in ldb_cmdline_process_internal 
../../lib/ldb/tools/cmdline.c:389
        #6 0x7fc1b5f1b53c in ldb_cmdline_process 
../../lib/ldb/tools/cmdline.c:544
        #7 0x000000202a19 in main ../../lib/ldb/tools/ldbdel.c:97
        #8 0x7fc1b542b2fa in __libc_start_call_main (/lib64/libc.so.6+0x2b2fa) 
(BuildId: 8523b213e7586a93ab00f6dd476418b1e521e62c)
        #9 0x7ffdced96847  ([stack]+0x38847)
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Noel Power <[email protected]>
    
    Autobuild-User(master): Andreas Schneider <[email protected]>
    Autobuild-Date(master): Wed Oct 22 09:25:35 UTC 2025 on atb-devel-224

commit 52dec2b3c8920ed6237d63b2de85269eab608101
Author: Andreas Schneider <[email protected]>
Date:   Wed Oct 22 09:38:20 2025 +0200

    lib:ldb:tools: Remove trailing spaces in cmdline.c
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Noel Power <[email protected]>

commit 5f9656e6e104701aa001232a5935c4c09a18a074
Author: Andreas Schneider <[email protected]>
Date:   Wed Oct 22 09:36:50 2025 +0200

    nsswitch: Fix memory leak in wbinfo_xids_to_sids()
    
    We should not allocate on the NULL context.
    
    =================================================================
    ==313033==ERROR: LeakSanitizer: detected memory leaks
    
    Direct leak of 376 byte(s) in 1 object(s) allocated from:
        #0 0x7ff48b520b4b  (/lib64/libasan.so.8+0x120b4b) (BuildId: 
388ee9ac193f74c177c6f52988d2d0dab110de41)
        #1 0x7ff48bb079d3 in _talloc_realloc ../../lib/talloc/talloc.c:2035
        #2 0x7ff48bb0824c in _talloc_realloc_array 
../../lib/talloc/talloc.c:2810
        #3 0x00000021ab91 in wbinfo_xids_to_sids ../../nsswitch/wbinfo.c:1122
        #4 0x00000021ab91 in main ../../nsswitch/wbinfo.c:3065
        #5 0x7ff48842b2fa in __libc_start_call_main (/lib64/libc.so.6+0x2b2fa) 
(BuildId: 8523b213e7586a93ab00f6dd476418b1e521e62c)
        #6 0x7ffd3dc6866e  ([stack]+0x2066e)
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Noel Power <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 lib/ldb/tools/cmdline.c | 18 +++++++++---------
 nsswitch/wbinfo.c       |  2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/ldb/tools/cmdline.c b/lib/ldb/tools/cmdline.c
index ff25fe05ec7..4f6068b985f 100644
--- a/lib/ldb/tools/cmdline.c
+++ b/lib/ldb/tools/cmdline.c
@@ -1,4 +1,4 @@
-/* 
+/*
    ldb database library - command line handling for ldb tools
 
    Copyright (C) Andrew Tridgell  2005
@@ -6,7 +6,7 @@
      ** NOTE! The following LGPL license applies to the ldb
      ** library. This does NOT imply that all of Samba is released
      ** under the LGPL
-   
+
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
@@ -317,7 +317,7 @@ static struct ldb_cmdline 
*ldb_cmdline_process_internal(struct ldb_context *ldb,
        }
 
        options = *ret;
-       
+
        /* pull in URL */
        options.url = getenv("LDB_URL");
 
@@ -366,7 +366,7 @@ static struct ldb_cmdline 
*ldb_cmdline_process_internal(struct ldb_context *ldb,
                        break;
 
                case 'o':
-                       options.options = talloc_realloc(ret, options.options, 
+                       options.options = talloc_realloc(ret, options.options,
                                                         const char *, 
num_options+3);
                        if (options.options == NULL) {
                                fprintf(stderr, "Out of memory!\n");
@@ -386,10 +386,10 @@ static struct ldb_cmdline 
*ldb_cmdline_process_internal(struct ldb_context *ldb,
 
                                t = strchr(p, ',');
                                if (t == NULL) {
-                                       c = talloc_strdup(options.controls, p);
+                                       c = talloc_strdup(ret, p);
                                        p = NULL;
                                } else {
-                                       c = talloc_strndup(options.controls, p, 
t-p);
+                                       c = talloc_strndup(ret, p, t-p);
                                        p = t + 1;
                                }
                                if (c == NULL || !add_control(ret, c)) {
@@ -398,7 +398,7 @@ static struct ldb_cmdline 
*ldb_cmdline_process_internal(struct ldb_context *ldb,
                                }
                        }
 
-                       break;    
+                       break;
                }
                case 'P':
                        if (!add_control(ret, "paged_results:1:1024")) {
@@ -449,7 +449,7 @@ static struct ldb_cmdline 
*ldb_cmdline_process_internal(struct ldb_context *ldb,
                        }
                        break;
                default:
-                       fprintf(stderr, "Invalid option %s: %s\n", 
+                       fprintf(stderr, "Invalid option %s: %s\n",
                                poptBadOption(pc, 0), poptStrerror(opt));
                        if (usage) usage(ldb);
                        goto failed;
@@ -504,7 +504,7 @@ static struct ldb_cmdline 
*ldb_cmdline_process_internal(struct ldb_context *ldb,
 
        /* now connect to the ldb */
        if (ldb_connect(ldb, ret->url, flags, ret->options) != LDB_SUCCESS) {
-               fprintf(stderr, "Failed to connect to %s - %s\n", 
+               fprintf(stderr, "Failed to connect to %s - %s\n",
                        ret->url, ldb_errstring(ldb));
                goto failed;
        }
diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c
index 1b3fb41b2d8..39d03f7bd1b 100644
--- a/nsswitch/wbinfo.c
+++ b/nsswitch/wbinfo.c
@@ -1119,7 +1119,7 @@ static bool wbinfo_xids_to_sids(const char *arg)
        p = arg;
 
        while (next_token_talloc(frame, &p, &idstr, LIST_SEP)) {
-               xids = talloc_realloc(xids,
+               xids = talloc_realloc(frame,
                                      xids,
                                      struct wbcUnixId,
                                      num_xids + 1);


-- 
Samba Shared Repository

Reply via email to