diff options
Diffstat (limited to 'service/src/main.c')
| -rw-r--r-- | service/src/main.c | 8 |
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); |
