Fix a memory leak when fread() fails

Fixes a possible leak in qcms_profile_from_file() when fread()
can't read the entire profile.
diff --git a/iccread.c b/iccread.c
index c721fbe..63029ae 100644
--- a/iccread.c
+++ b/iccread.c
@@ -765,8 +765,10 @@
 
 	/* read the rest profile */
 	read_length = fread((unsigned char*)data + sizeof(length_be), 1, remaining_length, file);
-	if (read_length != remaining_length)
+	if (read_length != remaining_length) {
+		free(data);
 		return INVALID_PROFILE;
+	}
 
 	profile = qcms_profile_from_memory(data, length);
 	free(data);
diff --git a/invalid-coverage.c b/invalid-coverage.c
index 312515b..c402252 100644
--- a/invalid-coverage.c
+++ b/invalid-coverage.c
@@ -153,6 +153,9 @@
 	write_u32(128 + 4 + 4*6*3 + 4, 1100); // offset
 	qcms_profile_release(qcms_profile_from_memory(buf, 1500));
 
+	/* test out profiles that are the wrong size */
+	qcms_profile_from_path("sample-trunc.icc");
+
 	return 0;
 }
 
diff --git a/sample-trunc.icc b/sample-trunc.icc
new file mode 100644
index 0000000..8a41f39
--- /dev/null
+++ b/sample-trunc.icc
Binary files differ