Upon encountering an 's' in a format string, `g_variant_get()` takes
a pointer to a (gchar *) (i.e., (gchar **)) and sets it to
a newly-allocated copy of the string. It's the user's responsibility
to free up memory by using `g_free()`.
Change-Id: Ieec7ca25af592dfcdcca34dbe288ea347b80b102
if(++cnt == state->iters) {cnt = 0; g_main_loop_quit (state->main_loop); }
- if(state->buf[0] != 'r')
+ if(state->buf[0] != 'r') {
+ g_free(state->buf); /* free memory allocated by g_variant_get */
return;
+ }
if (state->is_lt) {
if (raw_data_on)
min = lt;
}
}
+
+ g_free(state->buf); /* free memory allocated by g_variant_get */
}
}
g_main_loop_quit(state->main_loop);
}
- if (state->buf[0] != 'R') /* skip warm-up tries */
+ if (state->buf[0] != 'R') { /* skip warm-up tries */
+ g_free(state->buf); /* free memory allocated by g_variant_get */
return;
+ }
if (state->is_lt) {
if (state->verbose)
else
g_print("Client said: %s %s\n", state->buf, timestamp);
}
+
+ g_free(state->buf); /* free memory allocated by g_variant_get */
}
static const GDBusInterfaceVTable interface_vtable = {