Changeset 77700 in vbox
- Timestamp:
- Mar 14, 2019 12:41:50 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/misc/json.cpp
r76553 r77700 934 934 935 935 /** 936 * Cleans up any resources still in control of the given token. 937 * 938 * @returns nothing. 939 * @param pToken The toke nto clean up. 940 */ 941 static void rtJsonTokenizerTokenCleanup(PRTJSONTOKEN pToken) 942 { 943 if ( pToken->enmClass == RTJSONTOKENCLASS_STRING 944 && pToken->Class.String.pszStr) 945 RTStrFree(pToken->Class.String.pszStr); 946 } 947 948 /** 936 949 * Destroys a given tokenizer state. 937 950 * … … 941 954 static void rtJsonTokenizerDestroy(PRTJSONTOKENIZER pTokenizer) 942 955 { 943 RT_NOREF_PV(pTokenizer); 956 rtJsonTokenizerTokenCleanup(pTokenizer->pTokenCurr); 957 rtJsonTokenizerTokenCleanup(pTokenizer->pTokenNext); 944 958 } 945 959 … … 1156 1170 { 1157 1171 char *pszName = pToken->Class.String.pszStr; /* We can consume this string as it was allocated. */ 1172 pToken->Class.String.pszStr = NULL; 1158 1173 1159 1174 rtJsonTokenizerConsume(pTokenizer); … … 1177 1192 if (papszNamesNew) 1178 1193 RTMemFree(papszNamesNew); 1194 RTStrFree(pszName); 1179 1195 rc = VERR_NO_MEMORY; 1180 1196 break; … … 1200 1216 pTokenizer->Pos.iLine, pTokenizer->Pos.iChStart); 1201 1217 } 1218 else 1219 RTStrFree(pszName); 1202 1220 } 1203 1221 else 1222 { 1223 RTStrFree(pszName); 1204 1224 rc = RTErrInfoSetF(pTokenizer->pErrInfo, VERR_JSON_MALFORMED, "expected name separator (line %zu col %zu)", 1205 1225 pTokenizer->Pos.iLine, pTokenizer->Pos.iChStart); 1226 } 1206 1227 } 1207 1228
Note:
See TracChangeset
for help on using the changeset viewer.