Skip to content

Commit a58dd6d

Browse files
pszymichsys_zuul
authored andcommitted
Changes in code.
Change-Id: Ica75407e834f6b3439912bd0b47a6b30a6521fc7
1 parent 8d4b8dc commit a58dd6d

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

visa/iga/IGALibrary/api/igax.hpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -492,16 +492,19 @@ inline iga::Op OpSpec::op() const
492492
}
493493

494494

495-
#define IGA_OPSPEC_STRING_GETTER(API, INITSIZE) { \
496-
char _staticBuf[INITSIZE]; \
497-
char *strPtr = &_staticBuf[0]; \
498-
size_t strCap = sizeof(_staticBuf); \
499-
IGA_CHECKED_CALL(API, m_op, strPtr, &strCap); \
500-
if (strCap > sizeof(_staticBuf)) { \
501-
strPtr = (char *)alloca(strCap); \
495+
#define IGA_OPSPEC_STRING_GETTER(API, INITSIZE) { \
496+
char _staticBuf[INITSIZE]; \
497+
char *strPtr = &_staticBuf[0]; \
498+
size_t strCap = sizeof(_staticBuf); \
499+
IGA_CHECKED_CALL(API, m_op, strPtr, &strCap); \
500+
if (strCap > sizeof(_staticBuf)) { \
501+
strPtr = (char *)malloc(strCap); \
502502
IGA_CHECKED_CALL(API, m_op, strPtr, &strCap); \
503-
} \
504-
return std::string(strPtr); \
503+
std::string res(strPtr); \
504+
free(strPtr); \
505+
return res; \
506+
} \
507+
return std::string(strPtr); \
505508
}
506509
inline std::string OpSpec::menmonic() const
507510
IGA_OPSPEC_STRING_GETTER(iga_opspec_mnemonic, 16);

0 commit comments

Comments
 (0)