Bug 34747 - re-check all realloc() error handling
Summary: re-check all realloc() error handling
Status: RESOLVED WONTFIX
Alias: None
Product: UCS
Classification: Unclassified
Component: License
Version: UCS 4.4
Hardware: Other Linux
: P5 normal
Target Milestone: ---
Assignee: UMC maintainers
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-06 08:27 CEST by Philipp Hahn
Modified: 2025-02-05 09:28 CET (History)
1 user (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Customer ID:
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hahn univentionstaff 2014-05-06 08:27:04 CEST
man realloc:
> RETURN VALUE
>  The realloc() function returns ... NULL if the request fails. ...
>  If realloc() fails the original block is left untouched; it is not freed or moved.

In the listener the return value is currently directly assigned to the "parent container". On allocation errors this would not only lose the previous content, but also proper handling is missing in most cases.

They should be check and be changed to something like
 void *tmp = realloc(some_var, ...)
 if (tmp)
   some_var = tmp;
 else
   perror("Out-of-memory in realloc()");
Comment 1 Philipp Hahn univentionstaff 2014-05-06 08:31:43 CEST
Also see Bug #30263
Comment 2 Stefan Gohmann univentionstaff 2017-06-16 20:37:11 CEST
This issue has been filed against UCS 3. UCS 3 is out of the normal maintenance and many UCS components have vastly changed in UCS 4.

If this issue is still valid, please change the version to a newer UCS version otherwise this issue will be automatically closed in the next weeks.
Comment 3 Jan-Luca Kiok univentionstaff 2025-02-05 09:28:40 CET
This issue has been filed against UCS 4.4.

UCS 4.4 is out of maintenance and components may have vastly changed in later releases. Thus, this issue is now being closed.

If this issue still occurs in newer versions, please use "Clone this bug" or reopen this issue. In this case please provide information on how this issue is affecting you.