Skip to content

Commit

Permalink
Fix memory leak in some variorum JSON examples as detected by -fsanit…
Browse files Browse the repository at this point in the history
…ize=address.
  • Loading branch information
tpatki committed Jul 30, 2024
1 parent 42e0803 commit 841c449
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/examples/variorum-get-energy-json-example.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ int main(int argc, char **argv)
/* Print the entire JSON object */
puts(s);

/* Deallocate the string */
free(s);

#ifdef SECOND_RUN
for (i = 0; i < size; i++)
{
Expand Down
3 changes: 3 additions & 0 deletions src/examples/variorum-get-power-json-example.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ int main(int argc, char **argv)
/* Print the entire JSON object */
puts(s);

/* Deallocate the string */
free(s);

#ifdef SECOND_RUN
for (i = 0; i < size; i++)
{
Expand Down
3 changes: 3 additions & 0 deletions src/examples/variorum-get-utilization-json-example.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ int main(int argc, char **argv)
/* Print the entire JSON object */
puts(s);

/* Deallocate the string */
free(s);

#ifdef SECOND_RUN
for (i = 0; i < size; i++)
{
Expand Down
3 changes: 3 additions & 0 deletions src/examples/variorum-integration-using-json-example.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ int main(void)
puts(s);
parse_json_power_obj(s, num_sockets);

/* Deallocate the string */
free(s);

#ifdef SECOND_RUN
for (i = 0; i < size; i++)
{
Expand Down

0 comments on commit 841c449

Please sign in to comment.