Bug 2135405
| Summary: | bindresvport.c:132: Opened stream never closed. Potential resource leak in an return path | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | Zhi Li <yieli> |
| Component: | libtirpc | Assignee: | Steve Dickson <steved> |
| Status: | CLOSED ERRATA | QA Contact: | Zhi Li <yieli> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 9.2 | CC: | bxue, xzhou, yoyang |
| Target Milestone: | rc | Keywords: | Patch, Triaged |
| Target Release: | --- | Flags: | pm-rhel:
mirror+
|
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libtirpc-1.3.3-1.el9 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2023-05-09 08:19:31 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
commit 55526c52a449907e4d34b829b96141afab530b23 (HEAD -> master, origin/master, origin/HEAD)
Author: Zhi Li <yieli>
Date: Mon Oct 24 13:46:54 2022 -0400
bindresvport.c: fix a potential resource leakage
Close the FILE *fp of load_blacklist() in another
return path to avoid potential resource leakage.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (libtirpc bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2023:2506 |
Description of problem: A potential leak of fd issue has been found on /root/libtirpc-1.3.3/src/bindresvport.c inside libtirpc-1.1.3.el9. bindresvport.c: opened stream never closed. Potential resource leak static void load_blacklist (void) { FILE *fp; char *buf = NULL; size_t buflen = 0; int size = 0, ptr = 0; blacklist_read = 1; fp = fopen ("/etc/bindresvport.blacklist", "r"); if (NULL == fp) return; while (!feof (fp)) { -- snip -- if (ptr >= size) { size += 10; list = realloc (list, size * sizeof (int)); if (list == NULL) { free (buf); return; // << it didnot close fp in this return path } } list[ptr++] = port; } fclose (fp); // << fp closed in this return path if (buf) free (buf); list_size = ptr; } Version-Release number of selected component (if applicable): libtirpc-1.1.3.el9 Actual results: Potential leak of fd Expected results: No potential leak of fd Additional info: