Skip to content

Commit 5d4de36

Browse files
committed
8286705: GCC 12 reports use-after-free potential bugs
Reviewed-by: phh Backport-of: 0e4bece5b5143b8505496ea7430bbfa11e151aff
1 parent 741b340 commit 5d4de36

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/java.base/share/native/libjli/parse_manifest.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -288,8 +288,8 @@ find_positions(int fd, Byte *eb, jlong* base_offset, jlong* censtart)
288288
for (cp = &buffer[bytes - ENDHDR]; cp >= &buffer[0]; cp--)
289289
if (ENDSIG_AT(cp) && (cp + ENDHDR + ENDCOM(cp) == endpos)) {
290290
(void) memcpy(eb, cp, ENDHDR);
291-
free(buffer);
292291
pos = flen - (endpos - cp);
292+
free(buffer);
293293
return find_positions64(fd, eb, pos, base_offset, censtart);
294294
}
295295
free(buffer);

0 commit comments

Comments
 (0)