diff options
author | onefang | 2020-03-21 01:52:02 +1000 |
---|---|---|
committer | onefang | 2020-03-21 01:52:02 +1000 |
commit | 713ea324f5a8294e776c0dd9f2e47688a765fb28 (patch) | |
tree | 3905ceaf6d746a066aeca1a162da22d41f74bb62 /src/sledjchisl | |
parent | More version numbers. (diff) | |
download | opensim-SC_OLD-713ea324f5a8294e776c0dd9f2e47688a765fb28.zip opensim-SC_OLD-713ea324f5a8294e776c0dd9f2e47688a765fb28.tar.gz opensim-SC_OLD-713ea324f5a8294e776c0dd9f2e47688a765fb28.tar.bz2 opensim-SC_OLD-713ea324f5a8294e776c0dd9f2e47688a765fb28.tar.xz |
Plug more leaks.
I'm more and more sure that the rest are MariaDBs fault, but I'm still
searching.
Diffstat (limited to 'src/sledjchisl')
-rw-r--r-- | src/sledjchisl/sledjchisl.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index 2ecded0..4ca9b4e 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c | |||
@@ -2513,13 +2513,14 @@ HTMLfile *checkHTMLcache(char *file) | |||
2513 | if (NULL == HTMLfileCache) | 2513 | if (NULL == HTMLfileCache) |
2514 | HTMLfileCache = qhashtbl(0, 0); | 2514 | HTMLfileCache = qhashtbl(0, 0); |
2515 | 2515 | ||
2516 | HTMLfile *ret = (HTMLfile *) HTMLfileCache->get(HTMLfileCache, file, NULL, false); | 2516 | HTMLfile *ret = (HTMLfile *) HTMLfileCache->get(HTMLfileCache, file, NULL, true); |
2517 | int fd = open(file, O_RDONLY); | 2517 | int fd = open(file, O_RDONLY); |
2518 | size_t length = 0; | 2518 | size_t length = 0; |
2519 | 2519 | ||
2520 | if (-1 == fd) | 2520 | if (-1 == fd) |
2521 | { | 2521 | { |
2522 | HTMLfileCache->remove(HTMLfileCache, file); | 2522 | HTMLfileCache->remove(HTMLfileCache, file); |
2523 | free(ret); | ||
2523 | ret = NULL; | 2524 | ret = NULL; |
2524 | } | 2525 | } |
2525 | else | 2526 | else |
@@ -2528,6 +2529,7 @@ HTMLfile *checkHTMLcache(char *file) | |||
2528 | if (fstat(fd, &sb) == -1) | 2529 | if (fstat(fd, &sb) == -1) |
2529 | { | 2530 | { |
2530 | HTMLfileCache->remove(HTMLfileCache, file); | 2531 | HTMLfileCache->remove(HTMLfileCache, file); |
2532 | free(ret); | ||
2531 | ret = NULL; | 2533 | ret = NULL; |
2532 | E("Failed to stat %s", file); | 2534 | E("Failed to stat %s", file); |
2533 | } | 2535 | } |
@@ -2536,6 +2538,7 @@ HTMLfile *checkHTMLcache(char *file) | |||
2536 | if ((NULL != ret) && (ret->last.tv_sec < sb.st_mtim.tv_sec)) | 2538 | if ((NULL != ret) && (ret->last.tv_sec < sb.st_mtim.tv_sec)) |
2537 | { | 2539 | { |
2538 | HTMLfileCache->remove(HTMLfileCache, file); | 2540 | HTMLfileCache->remove(HTMLfileCache, file); |
2541 | free(ret); | ||
2539 | ret = NULL; | 2542 | ret = NULL; |
2540 | } | 2543 | } |
2541 | 2544 | ||
@@ -3399,7 +3402,7 @@ t("Lua %s = %s", n, (char *) obj.data); | |||
3399 | } | 3402 | } |
3400 | } | 3403 | } |
3401 | tnm->unlock(tnm); | 3404 | tnm->unlock(tnm); |
3402 | Rd->database->putstr(Rd->database, "UserAccounts.PrincipalID", tnm->getstr(tnm, "UUID", true)); | 3405 | Rd->database->putstr(Rd->database, "UserAccounts.PrincipalID", tnm->getstr(tnm, "UUID", false)); |
3403 | } | 3406 | } |
3404 | } | 3407 | } |
3405 | free(munchie); | 3408 | free(munchie); |
@@ -3557,12 +3560,14 @@ static int validateName(reqData *Rd, qhashtbl_t *data, char *nm) | |||
3557 | { | 3560 | { |
3558 | boolean login = strcmp("login", Rd->doit) == 0; | 3561 | boolean login = strcmp("login", Rd->doit) == 0; |
3559 | int ret = 0; | 3562 | int ret = 0; |
3560 | unsigned char *name = data->getstr(data, "name", true); // We have to be unsigned coz of isalnum(). | 3563 | unsigned char *name; // We have to be unsigned coz of isalnum(). |
3561 | char *where = NULL; | 3564 | char *where = NULL; |
3562 | 3565 | ||
3563 | if ((strcmp("cancel", Rd->doit) == 0) || (strcmp("logout", Rd->doit) == 0)) | 3566 | if ((strcmp("cancel", Rd->doit) == 0) || (strcmp("logout", Rd->doit) == 0)) |
3564 | return ret; | 3567 | return ret; |
3565 | 3568 | ||
3569 | name = data->getstr(data, "name", true); | ||
3570 | |||
3566 | if ((NULL == name) || ('\0' == name[0])) | 3571 | if ((NULL == name) || ('\0' == name[0])) |
3567 | { | 3572 | { |
3568 | bitch(Rd, "Please supply an account name.", "None supplied."); | 3573 | bitch(Rd, "Please supply an account name.", "None supplied."); |
@@ -3698,7 +3703,7 @@ static int validateName(reqData *Rd, qhashtbl_t *data, char *nm) | |||
3698 | Rd->stuff->putstr(Rd->stuff, "UUID", getStrH(Rd->database, "UserAccounts.PrincipalID")); | 3703 | Rd->stuff->putstr(Rd->stuff, "UUID", getStrH(Rd->database, "UserAccounts.PrincipalID")); |
3699 | Rd->stuff->putstr(Rd->stuff, "level", getStrH(Rd->database, "UserAccounts.Userlevel")); | 3704 | Rd->stuff->putstr(Rd->stuff, "level", getStrH(Rd->database, "UserAccounts.Userlevel")); |
3700 | if (s) {s--; *s = ' '; s++;} | 3705 | if (s) {s--; *s = ' '; s++;} |
3701 | Rd->stuff->putstr(Rd->stuff, "name", xstrdup(name)); | 3706 | Rd->stuff->putstr(Rd->stuff, "name", name); |
3702 | if (s) {s--; *s = '\0'; s++;} | 3707 | if (s) {s--; *s = '\0'; s++;} |
3703 | } | 3708 | } |
3704 | } | 3709 | } |
@@ -4055,7 +4060,7 @@ static int validateUUID(reqData *Rd, qhashtbl_t *data, char *name) | |||
4055 | if (rows) | 4060 | if (rows) |
4056 | { | 4061 | { |
4057 | dbPull(Rd, "UserAccounts", rows); | 4062 | dbPull(Rd, "UserAccounts", rows); |
4058 | Rd->stuff->putstr(Rd->stuff, "level", xstrdup(getStrH(Rd->database, "UserAccounts.Userlevel"))); | 4063 | Rd->stuff->putstr(Rd->stuff, "level", getStrH(Rd->database, "UserAccounts.Userlevel")); |
4059 | free(rows->rows); | 4064 | free(rows->rows); |
4060 | free(rows->fieldNames); | 4065 | free(rows->fieldNames); |
4061 | free(rows); | 4066 | free(rows); |
@@ -4064,7 +4069,7 @@ static int validateUUID(reqData *Rd, qhashtbl_t *data, char *name) | |||
4064 | { | 4069 | { |
4065 | Rd->database->putstr(Rd->database, "UserAccounts.PrincipalID", xstrdup(uuid)); | 4070 | Rd->database->putstr(Rd->database, "UserAccounts.PrincipalID", xstrdup(uuid)); |
4066 | } | 4071 | } |
4067 | Rd->stuff->putstr(Rd->stuff, "UUID", xstrdup(uuid)); | 4072 | Rd->stuff->putstr(Rd->stuff, "UUID", uuid); |
4068 | } | 4073 | } |
4069 | 4074 | ||
4070 | return ret; | 4075 | return ret; |
@@ -5016,6 +5021,7 @@ goto sendReply; | |||
5016 | 5021 | ||
5017 | tmp0 = qfile_get_ext(toybuf); | 5022 | tmp0 = qfile_get_ext(toybuf); |
5018 | tmp1 = mimeTypes->getstr(mimeTypes, tmp0, false); | 5023 | tmp1 = mimeTypes->getstr(mimeTypes, tmp0, false); |
5024 | free(tmp0); | ||
5019 | if (NULL != tmp1) | 5025 | if (NULL != tmp1) |
5020 | { | 5026 | { |
5021 | if (strncmp("text/", tmp1, 5) != 0) | 5027 | if (strncmp("text/", tmp1, 5) != 0) |
@@ -5051,6 +5057,7 @@ goto sendReply; | |||
5051 | 5057 | ||
5052 | getStats(database, stats); | 5058 | getStats(database, stats); |
5053 | unfragize(thisFile->fragments, Rd, false); | 5059 | unfragize(thisFile->fragments, Rd, false); |
5060 | free(thisFile); | ||
5054 | 5061 | ||
5055 | sendReply: | 5062 | sendReply: |
5056 | /* Send headers. | 5063 | /* Send headers. |