]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
coverity: a few bits of dead code and one vgdb command line leak
authorPaul Floyd <pjfloyd@wanadoo.fr>
Sat, 2 Sep 2023 21:19:17 +0000 (23:19 +0200)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Sat, 2 Sep 2023 21:19:17 +0000 (23:19 +0200)
coregrind/launcher-freebsd.c
coregrind/vgdb.c
include/pub_tool_basics.h
memcheck/mc_translate.c

index 030b183b572fc1027cf92fca1e91df61c44ac7dc..8687de3f59513b2d813dc2e107ea3193c9a835ed 100644 (file)
@@ -198,7 +198,7 @@ int main(int argc, char** argv, char** envp)
    const char *toolname = NULL;
    const char *clientname = NULL;
    const char *platform;
-   const char *default_platform;
+   const char *default_platform = VG_PLATFORM;
    const char *cp;
    char *toolfile;
    char launcher_name[PATH_MAX+1];
@@ -243,23 +243,6 @@ int main(int argc, char** argv, char** envp)
       toolname = "memcheck";
    }
 
-   /* Select a platform to use if we can't decide that by looking at
-      the executable (eg because it's a shell script).  Note that the
-      default_platform is not necessarily either the primary or
-      secondary build target.  Instead it's chosen to maximise the
-      chances that /bin/sh will work on it.  Hence for a primary
-      target of ppc64-linux we still choose ppc32-linux as the default
-      target, because on most ppc64-linux setups, the basic /bin,
-      /usr/bin, etc, stuff is built in 32-bit mode, not 64-bit
-      mode. */
-   if (0==strcmp(VG_PLATFORM,"x86-freebsd")) {
-      default_platform = "x86-freebsd";
-   } else if (0==strcmp(VG_PLATFORM,"amd64-freebsd")) {
-      default_platform = "amd64-freebsd";
-   } else {
-      barf("Unknown VG_PLATFORM '%s'", VG_PLATFORM);
-   }
-
    /* Work out what platform to use, or use the default platform if
       not possible. */
    if (clientname == NULL) {
index c024ffca6b9b226149a51dd991c4c8ff25360995..9e21a00d66626dd31258b0269fa112a654d032b3 100644 (file)
@@ -2269,6 +2269,11 @@ void parse_options(int argc, char** argv,
             arg_errors++;
          }
       } else if (is_opt(argv[i], "--vgdb-prefix=")) {
+         if (vgdb_prefix) {
+            // was specified more than once on the command line
+            // ignore earlier uses
+            free(vgdb_prefix);
+         }
          vgdb_prefix = strdup (argv[i] + 14);
       } else if (is_opt(argv[i], "--valgrind=")) {
           char *path = argv[i] + 11;
index d22a42523842102cd4178ea0d3b0887b9713275c..bf5a5ba7fa770a7aa0a7e5b441d811760df3263f 100644 (file)
@@ -233,11 +233,6 @@ typedef
       UWord _val;
       UWord _val2;
       Bool  _isError;
-#if defined(VGP_amd64_freebsd)
-      char  padding[7];
-#else
-      char  padding[3];
-#endif
    }
    SysRes;
 
index 72ccb3c8c6b5f4b3bf2a8dcd7182f655538b7afa..f8aca1641cab297e515c38c1fcf041f19078f9d4 100644 (file)
@@ -4822,18 +4822,11 @@ IRAtom* expr2vbits_Binop ( MCEnv* mce,
          and_or_ty = Ity_I1; improve = mkImproveOR1; goto do_And_Or;
 
       do_And_Or:
-         return
-         assignNew(
-            'V', mce, 
-            and_or_ty,
-            difd(mce, uifu(mce, vatom1, vatom2),
-                      difd(mce, improve(mce, atom1, vatom1),
-                                improve(mce, atom2, vatom2) ) ) );
-
          return assignNew('V', mce, and_or_ty,
             difd(mce, uifu(mce, vatom1, vatom2),
                       difd(mce, improve(mce, atom1, vatom1),
                                 improve(mce, atom2, vatom2) ) ) );
+
       case Iop_Xor8:
          return mkUifU8(mce, vatom1, vatom2);
       case Iop_Xor16: