]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
mk-lib1521: make the test set each string option again
authorDaniel Stenberg <daniel@haxx.se>
Sun, 4 Jan 2026 11:24:41 +0000 (12:24 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 4 Jan 2026 13:48:13 +0000 (14:48 +0100)
In an attempt to make sure that setting it again does not leak memory.

The second string is set to `""`, which is done so that this now finds
the problem reported in #20179.

Ref: #20179
Closes #20181

tests/libtest/mk-lib1521.pl

index a926049014a573a1dbacc5a58c7cfdb96eb91d7d..0a0c48b2f280819eb780a2c59692d2fcfd12a3c9 100755 (executable)
@@ -449,6 +449,8 @@ while(<STDIN>) {
         my $ifpresent = "${w2}if(present(first)) {\n";
         my $pref = "${w3}result =\n".
                    "${w3}  curl_easy_setopt(curl, $name,";
+        my $ignoreset = "${w3}/* set string again to check for leaks */\n".
+            "${w3}(void)curl_easy_setopt(curl, $name,";
         my $i = ' ' x (length($w) + 25);
         my $fcheck = <<MOO
     if(first && present(first)) /* first setopt check only */
@@ -494,6 +496,7 @@ MOO
         if($type eq "CURLOPTTYPE_STRINGPOINT") {
             print $fh "${fpref} \"string\");\n$fstringcheck";
             print $fh "$ifpresent";
+            print $fh "${ignoreset} \"\");\n";
             print $fh "${pref} NULL);\n$nullcheck";
         }
         elsif(($type eq "CURLOPTTYPE_LONG") ||