@@ -163,10 +163,17 @@ int flat_reopen_connection(struct flat_con* con)
if (con->file) {
fclose(con->file);
+ con->file = 0;
fn = get_name(con->id);
+ if (fn == 0) {
+ LOG(L_ERR, "flat_reopen_connection: get_name() failed\n");
+ return -1;
+ }
con->file = fopen(fn, "a");
+ pkg_free(fn);
+
if (!con->file) {
LOG(L_ERR, "flat_reopen_connection: Invalid parameter value\n");
return -1;