summaryrefslogtreecommitdiffstats
path: root/src/io/inkjar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/io/inkjar.cpp')
-rw-r--r--src/io/inkjar.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/io/inkjar.cpp b/src/io/inkjar.cpp
index c238aba36..20b164b99 100644
--- a/src/io/inkjar.cpp
+++ b/src/io/inkjar.cpp
@@ -139,16 +139,18 @@ bool JarFile::read_signature()
#endif
if (signature == 0x08074b50) {
- //skip data descriptor
- bytes = (guint8 *)malloc(sizeof(guint8) * 12);
- if (!read(bytes, 12)) {
- g_free(bytes);
- return false;
- }
+ //skip data descriptor
+ bytes = (guint8 *)g_malloc(sizeof(guint8) * 12);
+ if (!read(bytes, 12)) {
+ g_free(bytes);
+ return false;
+ } else {
+ g_free(bytes);
+ }
} else if (signature == 0x02014b50 || signature == 0x04034b50) {
- return true;
+ return true;
} else {
- return false;
+ return false;
}
return false;
}
@@ -214,6 +216,7 @@ GByteArray *JarFile::get_next_file_contents()
if (_last_filename != NULL)
g_free(_last_filename);
_last_filename = NULL;
+ g_free(bytes);
return NULL;
}