VirtualBox

Changeset 54706 in vbox


Ignore:
Timestamp:
Mar 10, 2015 6:39:06 PM (10 years ago)
Author:
vboxsync
Message:

asn1-generator-pass.h: Don't do anything stupid should RTAsn1MemAllocZ fail.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/asn1-generator-pass.h

    r52600 r54706  
    10871087# define RTASN1TMPL_MEMBER_DYN_COMMON(a_UnionNm, a_PtrName, a_Type, a_Api, a_Allocation, a_enmMembNm, a_enmValue, a_IfStmt) \
    10881088        case a_enmValue: \
    1089             RT_CONCAT(a_Api,_Delete)(pThis->a_UnionNm.a_PtrName); \
    1090             RTAsn1MemFree(&pThis->Allocation, pThis->a_UnionNm.a_PtrName); \
    1091             pThis->a_UnionNm.a_PtrName = NULL; \
     1089            if (pThis->a_UnionNm.a_PtrName) \
     1090            { \
     1091                RT_CONCAT(a_Api,_Delete)(pThis->a_UnionNm.a_PtrName); \
     1092                RTAsn1MemFree(&pThis->Allocation, pThis->a_UnionNm.a_PtrName); \
     1093                pThis->a_UnionNm.a_PtrName = NULL; \
     1094            } \
    10921095            break
    10931096# define RTASN1TMPL_MEMBER_DYN_END(a_enmType, a_enmMembNm, a_Allocation) \
     
    11041107# define RTASN1TMPL_PCHOICE_ITAG_EX(a_uTag, a_enmChoice, a_PtrName, a_Name, a_Type, a_Api, a_fClue, a_Constraints) \
    11051108        case a_enmChoice: \
    1106             RT_CONCAT(a_Api,_Delete)(pThis->a_PtrName); \
    1107             RTAsn1MemFree(&pThis->Allocation, pThis->a_PtrName); \
    1108             pThis->a_PtrName = NULL; \
     1109            if (pThis->a_PtrName) \
     1110            { \
     1111                RT_CONCAT(a_Api,_Delete)(pThis->a_PtrName); \
     1112                RTAsn1MemFree(&pThis->Allocation, pThis->a_PtrName); \
     1113                pThis->a_PtrName = NULL; \
     1114            } \
    11091115            break
    11101116# define RTASN1TMPL_PCHOICE_XTAG_EX(a_uTag, a_enmChoice, a_PtrTnNm, a_CtxTagN, a_Name, a_Type, a_Api, a_Constraints) \
    11111117        case a_enmChoice: \
    1112             RT_CONCAT(a_Api,_Delete)(&pThis->a_PtrTnNm->a_Name); \
    1113             RTAsn1MemFree(&pThis->Allocation, pThis->a_PtrTnNm); \
    1114             pThis->a_PtrTnNm = NULL; \
     1118            if (pThis->a_PtrTnNm) \
     1119            { \
     1120                RT_CONCAT(a_Api,_Delete)(&pThis->a_PtrTnNm->a_Name); \
     1121                RTAsn1MemFree(&pThis->Allocation, pThis->a_PtrTnNm); \
     1122                pThis->a_PtrTnNm = NULL; \
     1123            } \
    11151124            break
    11161125# define RTASN1TMPL_END_PCHOICE() \
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette