mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-25 14:35:04 +00:00
Fixed some incorrect allocations.
This commit is contained in:
parent
6d33117dbe
commit
424557fcb8
1 changed files with 6 additions and 10 deletions
16
data.c
16
data.c
|
@ -494,7 +494,7 @@ void _timeline_write(snac *snac, char *id, char *msg, char *parent)
|
||||||
|
|
||||||
rename(gofn, gnfn);
|
rename(gofn, gnfn);
|
||||||
|
|
||||||
snac_debug(snac, 2,
|
snac_debug(snac, 1,
|
||||||
xs_fmt("_timeline_write updated grampa %s %s", grampa, gnfn));
|
xs_fmt("_timeline_write updated grampa %s %s", grampa, gnfn));
|
||||||
|
|
||||||
/* try to do the same with the local */
|
/* try to do the same with the local */
|
||||||
|
@ -505,7 +505,7 @@ void _timeline_write(snac *snac, char *id, char *msg, char *parent)
|
||||||
|
|
||||||
link(gnfn, gnlfn);
|
link(gnfn, gnlfn);
|
||||||
|
|
||||||
snac_debug(snac, 2,
|
snac_debug(snac, 1,
|
||||||
xs_fmt("_timeline_write updated grampa (local) %s %s", parent, gnlfn));
|
xs_fmt("_timeline_write updated grampa (local) %s %s", parent, gnlfn));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -514,16 +514,12 @@ void _timeline_write(snac *snac, char *id, char *msg, char *parent)
|
||||||
xs *j = xs_readall(f);
|
xs *j = xs_readall(f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
xs *g_msg = xs_json_loads(j);
|
xs *g_msg = xs_json_loads(j);
|
||||||
xs *meta = xs_dict_get(g_msg, "_snac");
|
d_char *meta = xs_dict_get(g_msg, "_snac");
|
||||||
d_char *p = xs_dict_get(meta, "parent");
|
d_char *p = xs_dict_get(meta, "parent");
|
||||||
|
|
||||||
free(grampa);
|
free(grampa);
|
||||||
|
grampa = xs_dup(p);
|
||||||
if (!xs_is_null(p))
|
|
||||||
p = xs_dup(p);
|
|
||||||
|
|
||||||
grampa = p;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue