]> xenbits.xensource.com Git - xen.git/commitdiff
xentrace: free CPU mask string before overwriting pointer
authorJan Beulich <jbeulich@suse.com>
Fri, 17 Jan 2025 07:53:27 +0000 (08:53 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 17 Jan 2025 07:53:27 +0000 (08:53 +0100)
While multiple -c options may be unexpected, we'd still better deal with
them properly.

Also restore the blank line that was bogusly zapped by the same commit.

Coverity-ID: 1638723
Fixes: e4ad2836842a ("xentrace: Implement cpu mask range parsing of human values (-c)")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Anthony PERARD <anthony.perard@vates.tech>
Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
tools/xentrace/xentrace.c

index 63b29f8442f4184a85f09f5ccc4c79a613903b32..a5aa3c1903f48df82cb2e23c1c0b2f45daf80191 100644 (file)
@@ -1105,8 +1105,10 @@ static void parse_args(int argc, char **argv)
             break;
 
         case 'c': /* set new cpu mask for filtering (when xch is set). */
+            free(opts.cpu_mask_str);
             opts.cpu_mask_str = strdup(optarg);
             break;
+
         case 'e': /* set new event mask for filtering*/
             parse_evtmask(optarg);
             break;