aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authoronefang2020-05-20 14:24:32 +1000
committeronefang2020-05-20 14:24:32 +1000
commit354389d88678bf26ba30002d9184c0a1365556ec (patch)
tree85c3a7c3bb61365c526a192c9225bb5b9228c9c0 /src
parentPrint the name from the session in various places. (diff)
downloadopensim-SC_OLD-354389d88678bf26ba30002d9184c0a1365556ec.zip
opensim-SC_OLD-354389d88678bf26ba30002d9184c0a1365556ec.tar.gz
opensim-SC_OLD-354389d88678bf26ba30002d9184c0a1365556ec.tar.bz2
opensim-SC_OLD-354389d88678bf26ba30002d9184c0a1365556ec.tar.xz
Leaks -=
Diffstat (limited to 'src')
-rw-r--r--src/sledjchisl/sledjchisl.c47
1 files changed, 34 insertions, 13 deletions
diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c
index bacab21..59e00ae 100644
--- a/src/sledjchisl/sledjchisl.c
+++ b/src/sledjchisl/sledjchisl.c
@@ -735,11 +735,21 @@ simList *getSims()
735 struct dirtree *new = dirtree_add_node(0, path, 0); 735 struct dirtree *new = dirtree_add_node(0, path, 0);
736 new->extra = (long) sims; 736 new->extra = (long) sims;
737 dirtree_handle_callback(new, filterSims); 737 dirtree_handle_callback(new, filterSims);
738
738 qsort(sims->sims, sims->num, sizeof(char *), qstrcmp); 739 qsort(sims->sims, sims->num, sizeof(char *), qstrcmp);
739 free(path); 740 free(path);
740 return sims; 741 return sims;
741} 742}
742 743
744void freeSimList(simList *sims)
745{
746 int i;
747
748 for (i = 0; i < sims->num; i++)
749 free(sims->sims[i]);
750 free(sims->sims);
751 free(sims);
752}
743 753
744static int filterInis(struct dirtree *node) 754static int filterInis(struct dirtree *node)
745{ 755{
@@ -747,7 +757,7 @@ static int filterInis(struct dirtree *node)
747 int l = strlen(node->name); 757 int l = strlen(node->name);
748 if (strncmp(&(node->name[l - 4]), ".ini", 4) == 0) 758 if (strncmp(&(node->name[l - 4]), ".ini", 4) == 0)
749 { 759 {
750 strcpy((char *) node->parent->extra, xstrdup(node->name)); 760 strcpy((char *) node->parent->extra, node->name);
751 return DIRTREE_ABORT; 761 return DIRTREE_ABORT;
752 } 762 }
753 return 0; 763 return 0;
@@ -773,12 +783,12 @@ char *getSimName(char *sim)
773 783
774 temp = xmprintf("%s/config/%s/%s", scRoot, sim, c); 784 temp = xmprintf("%s/config/%s/%s", scRoot, sim, c);
775 fd = xopenro(temp); 785 fd = xopenro(temp);
776 free(temp);
777 xregcomp(&pat, "RegionName = \"(.+)\"", REG_EXTENDED); 786 xregcomp(&pat, "RegionName = \"(.+)\"", REG_EXTENDED);
778 do 787 do
779 { 788 {
780 // TODO - get_line() is slow, and wont help much with DOS and Mac line endings. 789 // TODO - get_line() is slow, and wont help much with DOS and Mac line endings.
781 // gio_gets() isn't any faster really, but deals with DOS line endings at least. 790 // gio_gets() isn't any faster really, but deals with DOS line endings at least.
791 free(temp);
782 temp = get_line(fd); 792 temp = get_line(fd);
783 if (temp) 793 if (temp)
784 { 794 {
@@ -788,6 +798,7 @@ char *getSimName(char *sim)
788 if (pat.re_nsub > 0) 798 if (pat.re_nsub > 0)
789 { 799 {
790 ret = xmprintf("%.*s", (int) (m[1].rm_eo - m[1].rm_so), temp + m[1].rm_so); 800 ret = xmprintf("%.*s", (int) (m[1].rm_eo - m[1].rm_so), temp + m[1].rm_so);
801 free(temp);
791 break; 802 break;
792 } 803 }
793 } 804 }
@@ -2342,7 +2353,6 @@ cookie *setCookie(reqData *Rd, char *cki, char *value)
2342 free(ret); 2353 free(ret);
2343 ret = Rd->Rcookies->get(Rd->Rcookies, cook, NULL, false); 2354 ret = Rd->Rcookies->get(Rd->Rcookies, cook, NULL, false);
2344 free(cook); 2355 free(cook);
2345
2346 return ret; 2356 return ret;
2347} 2357}
2348 2358
@@ -2353,7 +2363,6 @@ char *getCookie(qhashtbl_t *cookies, char *cki)
2353 2363
2354 if (NULL != ck) 2364 if (NULL != ck)
2355 ret = ck->value; 2365 ret = ck->value;
2356
2357 return ret; 2366 return ret;
2358} 2367}
2359 2368
@@ -4035,10 +4044,12 @@ T(c);
4035// la = waitLoadAverage(la, loadAverageInc, simTimeOut); 4044// la = waitLoadAverage(la, loadAverageInc, simTimeOut);
4036 } 4045 }
4037 free(c); 4046 free(c);
4047 free(name);
4038 break; 4048 break;
4039 } 4049 }
4050 free(name);
4040 } 4051 }
4041 4052 freeSimList(sims);
4042 } 4053 }
4043 free(first); 4054 free(first);
4044 } 4055 }
@@ -4233,6 +4244,7 @@ static int sessionValidate(reqData *Rd, inputForm *iF, inputValue *iV)
4233 I("Validating LINKY hashish %s", hashish); 4244 I("Validating LINKY hashish %s", hashish);
4234 free(hashish); 4245 free(hashish);
4235 hashish = qhex_encode(t, sz); 4246 hashish = qhex_encode(t, sz);
4247 free(t);
4236 linky = TRUE; 4248 linky = TRUE;
4237 } 4249 }
4238 else 4250 else
@@ -6338,10 +6350,15 @@ static void cleanup(void)
6338 C("Caught signal, or quitting, cleaning up."); 6350 C("Caught signal, or quitting, cleaning up.");
6339 dbRequest **rq; 6351 dbRequest **rq;
6340 6352
6341 while (NULL != (rq = (dbRequest **) dbRequests->popfirst(dbRequests, NULL))) 6353 if (dbRequests)
6342 { 6354 {
6343 dbFreeRequest(*rq); 6355 while (NULL != (rq = (dbRequest **) dbRequests->popfirst(dbRequests, NULL)))
6344 free(rq); 6356 {
6357 dbFreeRequest(*rq);
6358 free(rq);
6359 }
6360 dbRequests->free(dbRequests);
6361 dbRequests = NULL;
6345 } 6362 }
6346 6363
6347 if (accountPages) 6364 if (accountPages)
@@ -6393,15 +6410,15 @@ static void cleanup(void)
6393 } 6410 }
6394 HTMLfileCache->unlock(HTMLfileCache); 6411 HTMLfileCache->unlock(HTMLfileCache);
6395 HTMLfileCache->free(HTMLfileCache); 6412 HTMLfileCache->free(HTMLfileCache);
6413 HTMLfileCache = NULL;
6396 } 6414 }
6397 if (mimeTypes) mimeTypes->free(mimeTypes); 6415 if (mimeTypes) mimeTypes->free(mimeTypes);
6398 mimeTypes = NULL; 6416 mimeTypes = NULL;
6399 if (dbRequests) dbRequests->free(dbRequests);
6400 dbRequests = NULL;
6401 if (database) mysql_close(database); 6417 if (database) mysql_close(database);
6402 database = NULL; 6418 database = NULL;
6403 mysql_library_end(); 6419 mysql_library_end();
6404 lua_close(L); 6420 if (L) lua_close(L);
6421 L = NULL;
6405 if (stats) 6422 if (stats)
6406 { 6423 {
6407 if (stats->stats) stats->stats->free(stats->stats); 6424 if (stats->stats) stats->stats->free(stats->stats);
@@ -6409,6 +6426,7 @@ static void cleanup(void)
6409 stats = NULL; 6426 stats = NULL;
6410 } 6427 }
6411 if (configs) configs->free(configs); 6428 if (configs) configs->free(configs);
6429 configs = NULL;
6412} 6430}
6413 6431
6414 6432
@@ -6416,7 +6434,6 @@ void sledjchisl_main(void)
6416{ 6434{
6417 char *cmd = *toys.optargs; 6435 char *cmd = *toys.optargs;
6418 char *tmp; 6436 char *tmp;
6419 gridStats *stats = NULL;
6420 struct stat statbuf; 6437 struct stat statbuf;
6421 int status, result, i; 6438 int status, result, i;
6422 void *vd; 6439 void *vd;
@@ -7158,7 +7175,7 @@ fcgiDone:
7158 // The sudo is only so that the session is owned by opensim, otherwise it's owned by whoever ran this script, which is a likely security hole. 7175 // The sudo is only so that the session is owned by opensim, otherwise it's owned by whoever ran this script, which is a likely security hole.
7159 // After the session is created, we rely on the scRun directory to be group sticky, so that anyone in the opensim group can attach to the tmux socket. 7176 // After the session is created, we rely on the scRun directory to be group sticky, so that anyone in the opensim group can attach to the tmux socket.
7160 snprintf(toybuf, sizeof(toybuf), 7177 snprintf(toybuf, sizeof(toybuf),
7161 "sudo -Hu %s %s %s/%s new-session -d -s %s -n '%s' \\; split-window -bhp 50 -t '%s:' bash -c './sledjchisl; cd %s; bash'", 7178 "sudo -Hu %s %s %s/%s new-session -d -s %s -n '%s' \\; split-window -bhp 50 -t '%s:' bash -c '/usr/bin/valgrind --leak-check=full ./sledjchisl; cd %s; bash'",
7162 scUser, Tcmd, scRun, Tsocket, Tconsole, Ttab, Tconsole, scRoot); 7179 scUser, Tcmd, scRun, Tsocket, Tconsole, Ttab, Tconsole, scRoot);
7163 i = system(toybuf); 7180 i = system(toybuf);
7164 if (!WIFEXITED(i)) 7181 if (!WIFEXITED(i))
@@ -7226,7 +7243,9 @@ fcgiDone:
7226 I("%s is done starting up.", name); 7243 I("%s is done starting up.", name);
7227 la = waitLoadAverage(la, loadAverageInc, simTimeOut); 7244 la = waitLoadAverage(la, loadAverageInc, simTimeOut);
7228 } 7245 }
7246 free(nm);
7229 } 7247 }
7248 free(name);
7230 } 7249 }
7231 7250
7232 } 7251 }
@@ -7247,6 +7266,8 @@ fcgiDone:
7247 { 7266 {
7248 } 7267 }
7249 7268
7269 freeSimList(sims);
7270
7250/* 7271/*
7251 double sum; 7272 double sum;
7252 7273