Fix leak in RegTokenClose().

This commit is contained in:
Jordan Bancino 2023-11-08 08:43:23 -05:00
parent 647778ef82
commit d60aac6d3a

View file

@ -154,13 +154,17 @@ RegTokenFree(RegTokenInfo *tokeninfo)
int int
RegTokenClose(RegTokenInfo * tokeninfo) RegTokenClose(RegTokenInfo * tokeninfo)
{ {
HashMap *json;
if (!tokeninfo) if (!tokeninfo)
{ {
return 0; return 0;
} }
/* Write object to database. */ /* Write object to database. */
DbJsonSet(tokeninfo->ref, RegTokenInfoToJson(tokeninfo)); json = RegTokenInfoToJson(tokeninfo);
DbJsonSet(tokeninfo->ref, json); /* Copies json into internal structure. */
JsonFree(json);
return DbUnlock(tokeninfo->db, tokeninfo->ref); return DbUnlock(tokeninfo->db, tokeninfo->ref);
} }