Skip to content
Snippets Groups Projects
Commit 2e7d0134 authored by Sergey Linev's avatar Sergey Linev
Browse files

Fix clang-tidy issues in rootx executables

Cleanup memory, use strlcpy
parent 891a4739
No related branches found
No related tags found
No related merge requests found
......@@ -142,7 +142,7 @@ static void SetRootSys()
int l2 = strlen(ep) + 10;
char *env = new char[l2];
snprintf(env, l2, "ROOTSYS=%s", ep);
putenv(env);
putenv(env); // NOLINT: allocated memory now used by environment variable
}
}
delete [] ep;
......@@ -351,6 +351,8 @@ int main(int argc, char **argv)
fprintf(stderr, "%s: can't start ROOT notebook -- this option is only available when building with CMake, please check that %s exists\n",
argv[0], arg0);
delete [] argvv;
return 1;
}
......@@ -468,5 +470,7 @@ int main(int argc, char **argv)
fprintf(stderr, "%s: can't start ROOT -- check that %s exists!\n",
argv[0], arg0);
delete [] argvv;
return 1;
}
......@@ -30,6 +30,7 @@
#include "Rtypes.h"
#include "snprintf.h"
#include "strlcpy.h"
#include "rootcoreteam.h"
......@@ -779,8 +780,9 @@ int DrawCredits(bool draw, bool extended)
struct passwd *pwd = getpwuid(getuid());
if (pwd) {
char *name = new char [strlen(pwd->pw_gecos)+1];
strcpy(name, pwd->pw_gecos);
size_t sz = strlen(pwd->pw_gecos)+1;
char *name = new char [sz];
strlcpy(name, pwd->pw_gecos, sz);
char *s = strchr(name, ',');
if (s) *s = 0;
char line[1024];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment