Skip to content

Commit

Permalink
8301170: perfMemory_windows.cpp add free_security_attr to early returns
Browse files Browse the repository at this point in the history
Reviewed-by: stuefe, dholmes
  • Loading branch information
MBaesken committed Jan 31, 2023
1 parent 33e653e commit 810c8a2
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/hotspot/os/windows/perfMemory_windows.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -1240,6 +1240,7 @@ static bool make_user_tmp_dir(const char* dirname) {
if (PrintMiscellaneous && Verbose) {
warning("%s directory is insecure\n", dirname);
}
free_security_attr(pDirSA);
return false;
}
// The administrator should be able to delete this directory.
Expand All @@ -1255,18 +1256,15 @@ static bool make_user_tmp_dir(const char* dirname) {
dirname, lasterror);
}
}
}
else {
} else {
if (PrintMiscellaneous && Verbose) {
warning("CreateDirectory failed: %d\n", GetLastError());
}
free_security_attr(pDirSA);
return false;
}
}

// free the security attributes structure
free_security_attr(pDirSA);

return true;
}

Expand Down Expand Up @@ -1298,6 +1296,8 @@ static HANDLE create_sharedmem_resources(const char* dirname, const char* filena
if (!make_user_tmp_dir(dirname)) {
// could not make/find the directory or the found directory
// was not secure
free_security_attr(lpFileSA);
free_security_attr(lpSmoSA);
return NULL;
}

Expand Down Expand Up @@ -1329,6 +1329,7 @@ static HANDLE create_sharedmem_resources(const char* dirname, const char* filena
if (PrintMiscellaneous && Verbose) {
warning("could not create file %s: %d\n", filename, lasterror);
}
free_security_attr(lpSmoSA);
return NULL;
}

Expand Down

3 comments on commit 810c8a2

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MBaesken
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 810c8a2 Feb 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MBaesken Could not automatically backport 810c8a27 to openjdk/jdk17u-dev due to conflicts in the following files:

  • src/hotspot/os/windows/perfMemory_windows.cpp

Please fetch the appropriate branch/commit and manually resolve these conflicts by using the following commands in your personal fork of openjdk/jdk17u-dev. Note: these commands are just some suggestions and you can use other equivalent commands you know.

# Fetch the up-to-date version of the target branch
$ git fetch --no-tags https://git.openjdk.org/jdk17u-dev master:master

# Check out the target branch and create your own branch to backport
$ git checkout master
$ git checkout -b MBaesken-backport-810c8a27

# Fetch the commit you want to backport
$ git fetch --no-tags https://git.openjdk.org/jdk 810c8a271b4524ae776e2306ef699e04a7d145a2

# Backport the commit
$ git cherry-pick --no-commit 810c8a271b4524ae776e2306ef699e04a7d145a2
# Resolve conflicts now

# Commit the files you have modified
$ git add files/with/resolved/conflicts
$ git commit -m 'Backport 810c8a271b4524ae776e2306ef699e04a7d145a2'

Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk17u-dev with the title Backport 810c8a271b4524ae776e2306ef699e04a7d145a2.

Please sign in to comment.