Fix memory leak for _parse_str in case of error.
This commit is contained in:
1 parent
9710e014f2
commit
9340c2e55c
6 files changed
+50
-45
No files matched your search
+6
-5
@@ -989,7 +989,7 @@ typedef enum {
|
||||
{ \
|
||||
RBTREEI_CONTRACT(rbtree); \
|
||||
assert (str != NULL); \
|
||||
M_C(name,_clean)(rbtree); \
|
||||
M_C(name,_clean)(rbtree); \
|
||||
bool success = false; \
|
||||
int c = *str++; \
|
||||
if (M_UNLIKELY (c != '[')) goto exit; \
|
||||
@@ -1002,11 +1002,12 @@ typedef enum {
|
||||
do { \
|
||||
bool b = M_CALL_PARSE_STR(oplist, item, str, &str); \
|
||||
do { c = *str++; } while (isspace(c)); \
|
||||
if (b == false || c == 0) goto exit; \
|
||||
M_C(name, _push)(rbtree, item); \
|
||||
} while (c == M_GET_SEPARATOR oplist); \
|
||||
M_CALL_CLEAR(oplist, item); \
|
||||
if (b == false || c == 0) goto exit_clear; \
|
||||
M_C(name, _push)(rbtree, item); \
|
||||
} while (c == M_GET_SEPARATOR oplist); \
|
||||
success = (c == ']'); \
|
||||
exit_clear: \
|
||||
M_CALL_CLEAR(oplist, item); \
|
||||
exit: \
|
||||
if (endp) *endp = str; \
|
||||
return success; \
|
||||
|
||||
Reference in new issue
Block a user