diff options
author | onefang | 2020-04-23 17:23:14 +1000 |
---|---|---|
committer | onefang | 2020-04-23 17:23:14 +1000 |
commit | 103a4fe9bbd4a1ff33f0643bb749d4feed97905f (patch) | |
tree | 2744b8fb809ad20511f783a88535844aac8fd1ce | |
parent | Failed attempt to show a saved message. (diff) | |
download | opensim-SC-103a4fe9bbd4a1ff33f0643bb749d4feed97905f.zip opensim-SC-103a4fe9bbd4a1ff33f0643bb749d4feed97905f.tar.gz opensim-SC-103a4fe9bbd4a1ff33f0643bb749d4feed97905f.tar.bz2 opensim-SC-103a4fe9bbd4a1ff33f0643bb749d4feed97905f.tar.xz |
Leaks--
-rw-r--r-- | src/sledjchisl/sledjchisl.c | 63 |
1 files changed, 52 insertions, 11 deletions
diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index 1e90f37..95d03fc 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c | |||
@@ -1683,6 +1683,9 @@ d("dbPull(Rd->database) %s = %s", where, (char *) obj.data); | |||
1683 | } | 1683 | } |
1684 | me->unlock(me); | 1684 | me->unlock(me); |
1685 | me->free(me); | 1685 | me->free(me); |
1686 | free(rows->fieldNames); | ||
1687 | rows->rows->free(rows->rows); | ||
1688 | free(rows); | ||
1686 | } | 1689 | } |
1687 | 1690 | ||
1688 | void dbFreeRequest(dbRequest *req) | 1691 | void dbFreeRequest(dbRequest *req) |
@@ -3146,7 +3149,9 @@ T("free sesh %s %s", linky ? "linky" : "session", wipe ? "wipe" : "delete"); | |||
3146 | while(Rd->database->getnext(Rd->database, &obj, false) == true) | 3149 | while(Rd->database->getnext(Rd->database, &obj, false) == true) |
3147 | Rd->database->remove(Rd->database, obj.name); | 3150 | Rd->database->remove(Rd->database, obj.name); |
3148 | Rd->database->unlock(Rd->database); | 3151 | Rd->database->unlock(Rd->database); |
3152 | if (NULL != shs->name) free(shs->name); | ||
3149 | shs->name = NULL; | 3153 | shs->name = NULL; |
3154 | if (NULL != shs->UUID) free(shs->UUID); | ||
3150 | shs->UUID = NULL; | 3155 | shs->UUID = NULL; |
3151 | shs->level = -256; | 3156 | shs->level = -256; |
3152 | // TODO - should I wipe the rest of Rd->shs as well? | 3157 | // TODO - should I wipe the rest of Rd->shs as well? |
@@ -3279,6 +3284,8 @@ t("Write shs %s", tnm4); | |||
3279 | futimens(fd, shs->timeStamp); | 3284 | futimens(fd, shs->timeStamp); |
3280 | xclose(fd); | 3285 | xclose(fd); |
3281 | free(tnm9); | 3286 | free(tnm9); |
3287 | free(tnm4); | ||
3288 | free(tnm3); | ||
3282 | free(tnm2); | 3289 | free(tnm2); |
3283 | free(tnm1); | 3290 | free(tnm1); |
3284 | free(tnm0); | 3291 | free(tnm0); |
@@ -3811,18 +3818,14 @@ W("Validated session linky."); | |||
3811 | qstrcpy(shs->munchie, sizeof(shs->munchie), munchie); | 3818 | qstrcpy(shs->munchie, sizeof(shs->munchie), munchie); |
3812 | qstrcpy(shs->salt, sizeof(shs->salt), tnm->getstr(tnm, "salt", false)); | 3819 | qstrcpy(shs->salt, sizeof(shs->salt), tnm->getstr(tnm, "salt", false)); |
3813 | qstrcpy(shs->seshID, sizeof(shs->seshID), tnm->getstr(tnm, "seshID", false)); | 3820 | qstrcpy(shs->seshID, sizeof(shs->seshID), tnm->getstr(tnm, "seshID", false)); |
3814 | // TODO - free this somewhere. | ||
3815 | // shs->name = tnm->getstr(tnm, "name", true); | ||
3816 | // shs->UUID = tnm->getstr(tnm, "UUID", true); | ||
3817 | shs->level = atoi(level); | 3821 | shs->level = atoi(level); |
3818 | // TODO - get level from somewhere and stuff it in shs. | 3822 | // TODO - get level from somewhere and stuff it in shs. |
3819 | shs->timeStamp[0].tv_nsec = UTIME_OMIT; | 3823 | shs->timeStamp[0].tv_nsec = UTIME_OMIT; |
3820 | shs->timeStamp[0].tv_sec = UTIME_OMIT; | 3824 | shs->timeStamp[0].tv_sec = UTIME_OMIT; |
3821 | memcpy(&shs->timeStamp[1], &st.st_mtim, sizeof(struct timespec)); | 3825 | memcpy(&shs->timeStamp[1], &st.st_mtim, sizeof(struct timespec)); |
3822 | } | 3826 | } |
3823 | // TODO - free this somewhere. | 3827 | shs->name = tnm->getstr(tnm, "name", true); // LEAKY! |
3824 | shs->name = tnm->getstr(tnm, "name", true); | 3828 | shs->UUID = tnm->getstr(tnm, "UUID", true); // LEAKY! |
3825 | shs->UUID = tnm->getstr(tnm, "UUID", true); | ||
3826 | } | 3829 | } |
3827 | 3830 | ||
3828 | qhashtbl_obj_t obj; | 3831 | qhashtbl_obj_t obj; |
@@ -4399,7 +4402,9 @@ static void accountAddWeb(reqData *Rd, inputForm *oF, inputValue *oV) | |||
4399 | 4402 | ||
4400 | static void accountLoginWeb(reqData *Rd, inputForm *oF, inputValue *oV) | 4403 | static void accountLoginWeb(reqData *Rd, inputForm *oF, inputValue *oV) |
4401 | { | 4404 | { |
4405 | if (NULL != Rd->shs.name) free(Rd->shs.name); | ||
4402 | Rd->shs.name = NULL; | 4406 | Rd->shs.name = NULL; |
4407 | if (NULL != Rd->shs.UUID) free(Rd->shs.UUID); | ||
4403 | Rd->shs.UUID = NULL; | 4408 | Rd->shs.UUID = NULL; |
4404 | accountWebHeaders(Rd, oF); | 4409 | accountWebHeaders(Rd, oF); |
4405 | accountWebFields(Rd, oF, oV); | 4410 | accountWebFields(Rd, oF, oV); |
@@ -4553,6 +4558,7 @@ static int accountRead(reqData *Rd, char *uuid, char *firstName, char *lastName) | |||
4553 | 4558 | ||
4554 | if (NULL != firstName) | 4559 | if (NULL != firstName) |
4555 | { | 4560 | { |
4561 | free(first); | ||
4556 | first = xstrdup(firstName); | 4562 | first = xstrdup(firstName); |
4557 | if (NULL == lastName) | 4563 | if (NULL == lastName) |
4558 | { | 4564 | { |
@@ -4564,11 +4570,15 @@ d("accountRead() single name |%s| |%s|", first, last); | |||
4564 | if (NULL != t) | 4570 | if (NULL != t) |
4565 | { | 4571 | { |
4566 | *t++ = '\0'; | 4572 | *t++ = '\0'; |
4573 | free(last); | ||
4567 | last = xstrdup(t); | 4574 | last = xstrdup(t); |
4568 | } | 4575 | } |
4569 | } | 4576 | } |
4570 | else | 4577 | else |
4578 | { | ||
4579 | free(last); | ||
4571 | last = xstrdup(lastName); | 4580 | last = xstrdup(lastName); |
4581 | } | ||
4572 | } | 4582 | } |
4573 | d("accountRead() UUID %s, name %s %s", uuid, first, last); | 4583 | d("accountRead() UUID %s, name %s %s", uuid, first, last); |
4574 | uuid_clear(binuuid); | 4584 | uuid_clear(binuuid); |
@@ -4722,7 +4732,11 @@ static int accountCreateSub(reqData *Rd, inputForm *iF, inputValue *iV) | |||
4722 | if (0 != ret) | 4732 | if (0 != ret) |
4723 | { | 4733 | { |
4724 | wipe = TRUE; | 4734 | wipe = TRUE; |
4735 | if (NULL != Rd->shs.name) free(Rd->shs.name); | ||
4736 | Rd->shs.name = NULL; | ||
4737 | if (NULL != Rd->shs.UUID) free(Rd->shs.UUID); | ||
4725 | Rd->shs.UUID = NULL; | 4738 | Rd->shs.UUID = NULL; |
4739 | Rd->shs.level = -256; | ||
4726 | Rd->output = "accountLogin"; | 4740 | Rd->output = "accountLogin"; |
4727 | } | 4741 | } |
4728 | } | 4742 | } |
@@ -4752,7 +4766,11 @@ static int accountAddSub(reqData *Rd, inputForm *iF, inputValue *iV) | |||
4752 | { | 4766 | { |
4753 | ret++; | 4767 | ret++; |
4754 | wipe = TRUE; | 4768 | wipe = TRUE; |
4769 | if (NULL != Rd->shs.name) free(Rd->shs.name); | ||
4770 | Rd->shs.name = NULL; | ||
4771 | if (NULL != Rd->shs.UUID) free(Rd->shs.UUID); | ||
4755 | Rd->shs.UUID = NULL; | 4772 | Rd->shs.UUID = NULL; |
4773 | Rd->shs.level = -256; | ||
4756 | Rd->output = "accountLogin"; | 4774 | Rd->output = "accountLogin"; |
4757 | } | 4775 | } |
4758 | else | 4776 | else |
@@ -4880,7 +4898,11 @@ d("Sub accountViewSub() %s %s %s", uuid, first, last); | |||
4880 | bitch(Rd, "Cannot view account.", "Account doesn't exist."); | 4898 | bitch(Rd, "Cannot view account.", "Account doesn't exist."); |
4881 | ret++; | 4899 | ret++; |
4882 | wipe = TRUE; | 4900 | wipe = TRUE; |
4901 | if (NULL != Rd->shs.name) free(Rd->shs.name); | ||
4902 | Rd->shs.name = NULL; | ||
4903 | if (NULL != Rd->shs.UUID) free(Rd->shs.UUID); | ||
4883 | Rd->shs.UUID = NULL; | 4904 | Rd->shs.UUID = NULL; |
4905 | Rd->shs.level = -256; | ||
4884 | Rd->output = "accountLogin"; | 4906 | Rd->output = "accountLogin"; |
4885 | } | 4907 | } |
4886 | else | 4908 | else |
@@ -4895,14 +4917,18 @@ d("Sub accountViewSub() %s %s %s", uuid, first, last); | |||
4895 | { | 4917 | { |
4896 | ret++; | 4918 | ret++; |
4897 | wipe = TRUE; | 4919 | wipe = TRUE; |
4898 | Rd->shs.UUID = NULL; | 4920 | if (NULL != Rd->shs.name) free(Rd->shs.name); |
4921 | Rd->shs.name = NULL; | ||
4922 | if (NULL != Rd->shs.UUID) free(Rd->shs.UUID); | ||
4923 | Rd->shs.UUID = NULL; | ||
4924 | Rd->shs.level = -256; | ||
4899 | Rd->output = "accountLogin"; | 4925 | Rd->output = "accountLogin"; |
4900 | } | 4926 | } |
4901 | else | 4927 | else |
4902 | { | 4928 | { |
4903 | Rd->shs.level = atoi(getStrH(Rd->database, "UserAccounts.UserLevel")); | 4929 | Rd->shs.level = atoi(getStrH(Rd->database, "UserAccounts.UserLevel")); |
4904 | Rd->shs.name = getStrH(Rd->database, "Lua.name"); | 4930 | Rd->shs.name = Rd->database->getstr(Rd->database, "Lua.name", true); |
4905 | Rd->shs.UUID = getStrH(Rd->database, "UserAccounts.PrincipalID"); | 4931 | Rd->shs.UUID = Rd->database->getstr(Rd->database, "UserAccounts.PrincipalID", true); |
4906 | free(h); | 4932 | free(h); |
4907 | I("Logged on %s %s Level %d %s", Rd->shs.UUID, Rd->shs.name, Rd->shs.level, getLevel(Rd->shs.level)); | 4933 | I("Logged on %s %s Level %d %s", Rd->shs.UUID, Rd->shs.name, Rd->shs.level, getLevel(Rd->shs.level)); |
4908 | } | 4934 | } |
@@ -4954,7 +4980,11 @@ static int accountOutSub(reqData *Rd, inputForm *iF, inputValue *iV) | |||
4954 | else | 4980 | else |
4955 | { | 4981 | { |
4956 | // log the user out if they are logged in | 4982 | // log the user out if they are logged in |
4983 | if (NULL != Rd->shs.name) free(Rd->shs.name); | ||
4984 | Rd->shs.name = NULL; | ||
4985 | if (NULL != Rd->shs.UUID) free(Rd->shs.UUID); | ||
4957 | Rd->shs.UUID = NULL; | 4986 | Rd->shs.UUID = NULL; |
4987 | Rd->shs.level = -256; | ||
4958 | Rd->output = "accountLogin"; | 4988 | Rd->output = "accountLogin"; |
4959 | } | 4989 | } |
4960 | 4990 | ||
@@ -5011,7 +5041,11 @@ static void accountExploreValidatedVouchersWeb(reqData *Rd, inputForm *oF, input | |||
5011 | qlisttbl_t *list =getAccounts(Rd); | 5041 | qlisttbl_t *list =getAccounts(Rd); |
5012 | // char *name = getStrH(Rd->stuff, "name"); | 5042 | // char *name = getStrH(Rd->stuff, "name"); |
5013 | 5043 | ||
5044 | if (NULL != Rd->shs.name) free(Rd->shs.name); | ||
5045 | Rd->shs.name = NULL; | ||
5046 | if (NULL != Rd->shs.UUID) free(Rd->shs.UUID); | ||
5014 | Rd->shs.UUID = NULL; | 5047 | Rd->shs.UUID = NULL; |
5048 | Rd->shs.level = -256; | ||
5015 | accountWebHeaders(Rd, oF); | 5049 | accountWebHeaders(Rd, oF); |
5016 | accountWebFields(Rd, oF, oV); | 5050 | accountWebFields(Rd, oF, oV); |
5017 | 5051 | ||
@@ -5620,6 +5654,7 @@ void account_html(char *file, reqData *Rd, HTMLfile *thisFile) | |||
5620 | } | 5654 | } |
5621 | 5655 | ||
5622 | free(Rd->outQuery); | 5656 | free(Rd->outQuery); |
5657 | Rd->outQuery = NULL; | ||
5623 | 5658 | ||
5624 | C("Ending dynamic page %s %s", Rd->RUri, form); | 5659 | C("Ending dynamic page %s %s", Rd->RUri, form); |
5625 | } | 5660 | } |
@@ -6133,7 +6168,7 @@ if ((strcmp("HTTP_COOKIE", ky) == 0) || (strcmp("CONTENT_LENGTH", ky) == 0) || ( | |||
6133 | Rd->Scheme = Rd->headers->getstr(Rd->headers, "REQUEST_SCHEME", false); | 6168 | Rd->Scheme = Rd->headers->getstr(Rd->headers, "REQUEST_SCHEME", false); |
6134 | Rd->Host = Rd->headers->getstr(Rd->headers, "HTTP_HOST", false); | 6169 | Rd->Host = Rd->headers->getstr(Rd->headers, "HTTP_HOST", false); |
6135 | //char *SUri = Rd->headers->getstr(Rd->headers, "SCRIPT_URI", false); | 6170 | //char *SUri = Rd->headers->getstr(Rd->headers, "SCRIPT_URI", false); |
6136 | Rd->RUri = Rd->headers->getstr(Rd->headers, "REQUEST_URI", false); | 6171 | Rd->RUri = Rd->headers->getstr(Rd->headers, "REQUEST_URI", true); |
6137 | //char *Cookies = Rd->headers->getstr(Rd->headers, "HTTP_COOKIE", false); | 6172 | //char *Cookies = Rd->headers->getstr(Rd->headers, "HTTP_COOKIE", false); |
6138 | //char *Referer = Rd->headers->getstr(Rd->headers, "HTTP_REFERER", false); | 6173 | //char *Referer = Rd->headers->getstr(Rd->headers, "HTTP_REFERER", false); |
6139 | //char *RAddr = Rd->headers->getstr(Rd->headers, "REMOTE_ADDR", false); | 6174 | //char *RAddr = Rd->headers->getstr(Rd->headers, "REMOTE_ADDR", false); |
@@ -6169,7 +6204,7 @@ t("QUERY"); | |||
6169 | { | 6204 | { |
6170 | T("ignoring QUERY"); | 6205 | T("ignoring QUERY"); |
6171 | Rd->queries = qhashtbl(0, 0); | 6206 | Rd->queries = qhashtbl(0, 0); |
6172 | // TODO - stop this from leaking. | 6207 | free(Rd->RUri); |
6173 | Rd->RUri = xmprintf("%s%s", Rd->Script, Path); | 6208 | Rd->RUri = xmprintf("%s%s", Rd->Script, Path); |
6174 | } | 6209 | } |
6175 | t("BODY"); | 6210 | t("BODY"); |
@@ -6352,6 +6387,11 @@ sendReply: | |||
6352 | 6387 | ||
6353 | fcgiDone: | 6388 | fcgiDone: |
6354 | FCGI_Finish(); | 6389 | FCGI_Finish(); |
6390 | if (NULL != Rd->outQuery) free(Rd->outQuery); | ||
6391 | if (NULL != Rd->shs.name) free(Rd->shs.name); | ||
6392 | Rd->shs.name = NULL; | ||
6393 | // if (NULL != Rd->shs.UUID) free(Rd->shs.UUID); // LEAKY! But crashy! | ||
6394 | Rd->shs.UUID = NULL; | ||
6355 | qgrow_free(Rd->reply); | 6395 | qgrow_free(Rd->reply); |
6356 | qlist_free(Rd->messages); | 6396 | qlist_free(Rd->messages); |
6357 | qlist_free(Rd->errors); | 6397 | qlist_free(Rd->errors); |
@@ -6365,6 +6405,7 @@ fcgiDone: | |||
6365 | qhashtbl_free(Rd->body); | 6405 | qhashtbl_free(Rd->body); |
6366 | qhashtbl_free(Rd->queries); | 6406 | qhashtbl_free(Rd->queries); |
6367 | if (Rd->lnk) free(Rd->lnk); | 6407 | if (Rd->lnk) free(Rd->lnk); |
6408 | free(Rd->RUri); | ||
6368 | 6409 | ||
6369 | struct timespec now; | 6410 | struct timespec now; |
6370 | if (-1 == clock_gettime(CLOCK_REALTIME, &now)) | 6411 | if (-1 == clock_gettime(CLOCK_REALTIME, &now)) |