Introduction
Introduction Statistics Contact Development Disclaimer Help
Extra checks, fixed cleanup in file generating routine - fiche - A pastebin adj…
git clone git://vernunftzentrum.de/fiche.git
Log
Files
Refs
LICENSE
---
commit 53c0027b3c38a0a253d975747037507780833d3c
parent 7575609c415f84320b7956279d4d2adef8a5228e
Author: solusipse <[email protected]>
Date: Sat, 2 Sep 2017 19:48:02 +0200
Extra checks, fixed cleanup in file generating routine
Diffstat:
fiche.c | 7 +++++++
1 file changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/fiche.c b/fiche.c
@@ -705,6 +705,10 @@ static void generate_slug(char **output, uint8_t length, u…
static int create_directory(char *output_dir, char *slug) {
+ if (!slug) {
+ return -1;
+ }
+
// Additional byte is for the slash
size_t len = strlen(output_dir) + strlen(slug) + 2;
@@ -740,10 +744,13 @@ static int save_to_file(uint8_t *data, char *output_dir, …
// Attempt file saving
FILE *f = fopen(path, "w");
if (!f) {
+ free(path);
return -1;
}
if ( fprintf(f, "%s", data) < 0 ) {
+ fclose(f);
+ free(path);
return -1;
}
You are viewing proxied material from vernunftzentrum.de. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.