Bug 34747 - re-check all realloc() error handling
re-check all realloc() error handling
Status: NEW
Product: UCS
Classification: Unclassified
Component: License
UCS 4.4
Other Linux
: P5 normal (vote)
: ---
Assigned To: UMC maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-05-06 08:27 CEST by Philipp Hahn
Modified: 2020-07-03 13:54 CEST (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):
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.