On Mon, 8 Feb 2021 09:05:23 GMT, Aleksey Shipilev <[email protected]> wrote:

> SonarCloud instance reports a new warning after JDK-8254702:
>  "Use of memory after it is freed"
> 
> char* getJvmLauncherLibPath(void) {
>        ...
>         popenStatus = popenCommand(pkgQueryCmd, pkg->name, findLauncherLib,
>                                                         &launcherLibPath);
>         if (popenStatus) {
>             free(launcherLibPath); <---- frees here
>             goto cleanup;
>         }
>     }
> 
> cleanup:
>     free(modulePath);
>     freePackageDesc(pkg);
> 
>     return launcherLibPath; <--- here
> }
> 
> We need to null it out before returning.
> 
> Additional testing:
>  - [x] Linux x86_64 (Ubuntu) `tools/jpackage`

Fine and trivial. Thanks for fixing.

I tried to understand what the fix for JDK-8254702 does but the issue 
description and the PR are a bit taciturn. This seems to be way more than just 
a split of C- and C++ sources as the PR suggested.

..Thomas

-------------

PR: https://git.openjdk.java.net/jdk/pull/2453

Reply via email to