forked from Telodendria/Telodendria
Fix leaks in json.
This commit is contained in:
parent
b1049a9a70
commit
e22cf38eac
2 changed files with 6 additions and 3 deletions
2
TODO.txt
2
TODO.txt
|
@ -19,7 +19,7 @@ Milestone: v0.3.0
|
||||||
[x] Profiles
|
[x] Profiles
|
||||||
[ ] Directory
|
[ ] Directory
|
||||||
|
|
||||||
[ ] Fix leaks in http, json
|
[x] Fix leaks in http, json
|
||||||
[x] Remove TelodendriaGenerateMemReport()
|
[x] Remove TelodendriaGenerateMemReport()
|
||||||
|
|
||||||
[ ] Cytoplasm
|
[ ] Cytoplasm
|
||||||
|
|
|
@ -45,7 +45,8 @@ static void
|
||||||
query(char *select, HashMap * json)
|
query(char *select, HashMap * json)
|
||||||
{
|
{
|
||||||
char *key;
|
char *key;
|
||||||
JsonValue *val = JsonValueObject(json);
|
JsonValue *rootVal = JsonValueObject(json);
|
||||||
|
JsonValue *val = rootVal;
|
||||||
|
|
||||||
key = strtok(select, "->");
|
key = strtok(select, "->");
|
||||||
|
|
||||||
|
@ -165,6 +166,8 @@ query(char *select, HashMap * json)
|
||||||
JsonEncodeValue(val, StreamStdout(), JSON_PRETTY);
|
JsonEncodeValue(val, StreamStdout(), JSON_PRETTY);
|
||||||
StreamPutc(StreamStdout(), '\n');
|
StreamPutc(StreamStdout(), '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JsonValueFree(rootVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -175,6 +178,7 @@ encode(char *str)
|
||||||
JsonEncodeValue(val, StreamStdout(), JSON_DEFAULT);
|
JsonEncodeValue(val, StreamStdout(), JSON_DEFAULT);
|
||||||
JsonValueFree(val);
|
JsonValueFree(val);
|
||||||
StreamPutc(StreamStdout(), '\n');
|
StreamPutc(StreamStdout(), '\n');
|
||||||
|
JsonValueFree(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -230,6 +234,5 @@ Main(Array * args)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonFree(json);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue