aboutsummaryrefslogtreecommitdiffstats
path: root/service/src/main.c
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2021-05-19 00:53:18 +0200
committerLouis Burda <quent.burda@gmail.com>2021-05-19 00:53:18 +0200
commit64e9b2ad130c0cf28797c3530683fc1cc6b0e9d3 (patch)
tree764a267e5d7e07fcbf84aea4de93f4a5ca8d7d5e /service/src/main.c
parent452885a387b3a1613defa378cee79eb97e7b4fc8 (diff)
downloadenowars5-service-stldoctor-64e9b2ad130c0cf28797c3530683fc1cc6b0e9d3.tar.gz
enowars5-service-stldoctor-64e9b2ad130c0cf28797c3530683fc1cc6b0e9d3.zip
enhanced checker functionality and minor changes / fixes in documentation and src
Diffstat (limited to 'service/src/main.c')
-rw-r--r--service/src/main.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/service/src/main.c b/service/src/main.c
index 095eb7d..3d62fc7 100644
--- a/service/src/main.c
+++ b/service/src/main.c
@@ -43,7 +43,7 @@ int
save_submission(struct parseinfo *info, char *stldata, int stlsize)
{
DIR *d;
- FILE *f;
+ FILE *f = NULL;
char *dirpath = NULL, *infopath = NULL, *modelpath = NULL;
dirpath = aprintf("%s/%s-%i", resultdir, info->hash, time(NULL));
@@ -70,9 +70,9 @@ save_submission(struct parseinfo *info, char *stldata, int stlsize)
fail:
if (f) fclose(f);
- remove(infopath);
- remove(modelpath);
- remove(dirpath);
+ if (infopath) remove(infopath);
+ if (modelpath) remove(modelpath);
+ if (dirpath) remove(dirpath);
free(dirpath);
free(modelpath);