textfile get functions returns memory allocated using malloc. String is now being re-allocated using glib functions to keep the code standard in the Proximity Monitor code. --- proximity/monitor.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/proximity/monitor.c b/proximity/monitor.c index d068142..a3cb8ef 100644 --- a/proximity/monitor.c +++ b/proximity/monitor.c @@ -91,13 +91,21 @@ static char *read_proximity_config(bdaddr_t *sba, bdaddr_t *dba, const char *alert) { char filename[PATH_MAX + 1], addr[18], key[38]; + char *str, *strnew; create_filename(filename, PATH_MAX, sba, "proximity"); ba2str(dba, addr); snprintf(key, sizeof(key), "%17s#%s", addr, alert); - return textfile_caseget(filename, key); + str = textfile_caseget(filename, key); + if (str == NULL) + return NULL; + + strnew = g_strdup(str); + free(str); + + return strnew; } static void char_discovered_cb(GSList *characteristics, guint8 status, -- 1.7.6 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html