Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • P Pacman
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
    • Requirements
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Filipe Laíns
  • Pacman
  • Repository
Switch branch/tag
  • pacman
  • lib
  • libalpm
  • be_local.c
Find file BlameHistoryPermalink
  • Rikard Falkeborn's avatar
    Add REALLOC macro to simplify realloc error handling · 1b328974
    Rikard Falkeborn authored Apr 13, 2020 and Allan McRae's avatar Allan McRae committed Apr 13, 2020
    
    
    realloc can fail just like the other memory allocation functions. Add a
    macro to simplify handling of realloc failures, similar to the already
    existing MALLOC, CALLOC, etc.
    
    Replace the existing realloc uses with the new macro, allowing us to
    move tedious error handling to the macro. Also, in be_package and
    be_sync, this fixes hypothetical memory leaks (and thereafter null
    pointer dereferences) in case realloc fails to shrink the allocated
    memory.
    
    Signed-off-by: default avatarRikard Falkeborn <rikard.falkeborn@gmail.com>
    Signed-off-by: Allan McRae's avatarAllan McRae <allan@archlinux.org>
    1b328974