# HG changeset patch # User normaldotcom # Date 2010-03-23 00:23:20 # Node ID 7f610e2808f2c9446abaece939f7595ef69bbc55 # Parent 5a5939bf5b527e01d871a8443a32fd5b3f612e42 Fixed many memory leaks diff --git a/src/common/options.c b/src/common/options.c --- a/src/common/options.c +++ b/src/common/options.c @@ -105,6 +105,8 @@ int options_init(int argc, char *argv[], if(chdir(configfileprefix)) fprintf(stderr, "Unable to chdir(\"%s\") where I expected to find config files, expect failure\n", configfileprefix); + free(configfileprefix); + _distren_asprintf(&configfile, "%s%s.conf", PACKAGE, myname); if(!configfile) { diff --git a/src/server/simpleslave.c b/src/server/simpleslave.c --- a/src/server/simpleslave.c +++ b/src/server/simpleslave.c @@ -211,6 +211,7 @@ int main(int argc, char *argv[]) return 1; } free(pathtoJobfile); + pathtoJobfile = NULL; struct stat buffer; int fstatus = stat(pathtoOutput, &buffer); @@ -226,7 +227,8 @@ int main(int argc, char *argv[]) free(urltoOutput); free(pathtoOutput); - + urltoOutput = NULL; + pathtoOutput = NULL; // Tell the server that rendering and upload are complete _web_finishframe(slavekey, password, jobnum, framenum); } @@ -245,6 +247,18 @@ int main(int argc, char *argv[]) } } + free(my_cfg); + free(outputExt); + free(datadir); + free(urltoTar); + free(pathtoTar); + free(pathtoTardir); + free(pathtoJob); + free(pathtoJobfile); + free(urltoJobfile); + free(urltoOutput); + free(pathtoRenderOutput); + free(pathtoOutdir); fprintf(stderr,"Goodbye!\n"); return 0; } diff --git a/src/server/slavefuncs.c b/src/server/slavefuncs.c --- a/src/server/slavefuncs.c +++ b/src/server/slavefuncs.c @@ -238,6 +238,9 @@ int curlpost(char *filename, char *url, /* cleanup the formpost junk */ curl_formfree(formpost); curl_slist_free_all (headerlist); + free(sjobnum); + free(sframenum); + free(sslavekey); } return res; } @@ -323,7 +326,7 @@ int exec_blender(char *input, char *outp fprintf(stderr, "read \"%s\"\n", buf); } execio_close(testrem); - + free(frame_str); return ret; } @@ -678,9 +681,7 @@ struct _web_memorystruct _web_getrequest /* we're done with libcurl, so clean it up */ curl_global_cleanup(); - return chunk; // 0 is OK, 1 is 404 or other error - } void _web_finishframe(int slavekey, char *slavepass, int jobnum, int framenum){ @@ -829,13 +830,13 @@ int slaveBenchmark(char *datadir, int *b else remove(output); - free(frame_str); - free(input); - free(output); - *benchmarkTime = abs(difftime(startTime,endTime)); float tmp = *benchmarkTime; tmp = (1/tmp) * 50000; *renderPower = (int)tmp; + free(realOutput); + free(frame_str); + free(input); + free(output); return ret; }