forked from Telodendria/Telodendria
[FIX] Fix memory issue when creating a configuration
This commit is contained in:
parent
a7d6dfc870
commit
39ef050109
1 changed files with 2 additions and 7 deletions
|
@ -136,6 +136,8 @@ ConfigCreateDefault(Db * db)
|
|||
config.registration = 0;
|
||||
config.federation = 1;
|
||||
|
||||
config.serverName = Malloc(HOST_NAME_MAX + 1);
|
||||
memset(config.serverName, 0, HOST_NAME_MAX + 1);
|
||||
gethostname(config.serverName, HOST_NAME_MAX);
|
||||
len = strlen(config.serverName) + 10;
|
||||
config.baseUrl = Malloc(len);
|
||||
|
@ -151,13 +153,6 @@ ConfigCreateDefault(Db * db)
|
|||
listener->tls.cert = NULL;
|
||||
ArrayAdd(config.listen, listener);
|
||||
|
||||
config.serverName = Malloc(HOST_NAME_MAX + 1);
|
||||
|
||||
/* TODO: Don't set that field(it has to because otherwise j2s will add
|
||||
* a NULL byte it seems.) */
|
||||
config.identityServer = StrDuplicate("");
|
||||
|
||||
|
||||
json = ConfigToJson(&config);
|
||||
|
||||
ref = DbCreate(db, 1, "config");
|
||||
|
|
Loading…
Reference in a new issue