]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
examples/libsmbclient: Fix CID #1273089 Resource leak
authorGünther Deschner <gd@samba.org>
Wed, 13 Aug 2025 17:04:39 +0000 (19:04 +0200)
committerAnoop C S <anoopcs@samba.org>
Tue, 19 Aug 2025 08:44:30 +0000 (08:44 +0000)
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
examples/libsmbclient/testctx.c

index e410731739a9a54dd31733adf2b79a65b75026c4..b5e6a63dd9b80b49893f1fefa425784b1b2b0376 100644 (file)
@@ -7,10 +7,12 @@ static void create_and_destroy_context (void)
 {
        int i;
        SMBCCTX *ctx;
+       char *option_name = strdup("debug_to_stderr");
        ctx = smbc_new_context ();
        /* Both should do the same thing */
        smbc_setOptionDebugToStderr(ctx, 1);
-       smbc_option_set(ctx, strdup("debug_to_stderr"), 1);
+       smbc_option_set(ctx, option_name, 1);
+       free(option_name);
        smbc_setDebug(ctx, 1);
        i = smbc_getDebug(ctx);
        if (i != 1) {