@@ -1216,7 +1216,13 @@ RsslRet rsslInitChannel(RsslChannel *chnl, RsslInProgInfo *inProg, RsslError *er
1216
1216
/* build it first */
1217
1217
size_t rsslLinkTypeLen = strlen (rsslLinkType );
1218
1218
1219
- rsslChnlImpl -> componentVer .componentVersion .data = _rsslMalloc (length + RSSL_ComponentVersionEnd_Len + Rssl_ComponentVersionPlatform_Len + Rssl_Bits_Len + rsslLinkTypeLen );
1219
+ if ((rsslChnlImpl -> componentVer .componentVersion .data = _rsslMalloc (length + RSSL_ComponentVersionEnd_Len + Rssl_ComponentVersionPlatform_Len + Rssl_Bits_Len + rsslLinkTypeLen )) == NULL )
1220
+ {
1221
+ _rsslSetError (error , chnl , RSSL_RET_FAILURE , 0 );
1222
+ snprintf (error -> text , MAX_RSSL_ERROR_TEXT , "<%s:%d> rsslInitChannel() Error: 0005 Memory allocation failed" , __FILE__ , __LINE__ );
1223
+ rsslChnlImpl -> Channel .state = RSSL_CH_STATE_CLOSED ;
1224
+ return RSSL_RET_FAILURE ;
1225
+ }
1220
1226
MemCopyByInt (rsslChnlImpl -> componentVer .componentVersion .data , rsslComponentVersionStart , RSSL_ComponentVersionStart_Len );
1221
1227
MemCopyByInt ((rsslChnlImpl -> componentVer .componentVersion .data + length ), rsslComponentVersionPlatform , Rssl_ComponentVersionPlatform_Len );
1222
1228
length += (rtrUInt32 )Rssl_ComponentVersionPlatform_Len ;
@@ -1247,7 +1253,13 @@ RsslRet rsslInitChannel(RsslChannel *chnl, RsslInProgInfo *inProg, RsslError *er
1247
1253
userInfoLength = rsslChnlImpl -> connOptsCompVer .componentVersion .length ;
1248
1254
}
1249
1255
1250
- rsslChnlImpl -> componentVer .componentVersion .data = _rsslMalloc (totalLength );
1256
+ if ((rsslChnlImpl -> componentVer .componentVersion .data = _rsslMalloc (totalLength )) == NULL )
1257
+ {
1258
+ _rsslSetError (error , chnl , RSSL_RET_FAILURE , 0 );
1259
+ snprintf (error -> text , MAX_RSSL_ERROR_TEXT , "<%s:%d> rsslInitChannel() Error: 0005 Memory allocation failed" , __FILE__ , __LINE__ );
1260
+ rsslChnlImpl -> Channel .state = RSSL_CH_STATE_CLOSED ;
1261
+ return RSSL_RET_FAILURE ;
1262
+ }
1251
1263
MemCopyByInt (rsslChnlImpl -> componentVer .componentVersion .data , rsslComponentVersionStart , RSSL_ComponentVersionStart_Len );
1252
1264
length = (rtrUInt32 )RSSL_ComponentVersionStart_Len ;
1253
1265
/* see explanation above the declaration of defaultLength to understand the pointer arithmetic below */
0 commit comments