In 2 error paths we returned without freeing the allocated buf.
Collapse them into a compound test & free buf on the way out.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
*/
if (be32_to_cpu(rhead->h_cycle) !=
be32_to_cpu(*(__be32 *)ptr)) {
- if (*read_type == FULL_READ)
- return -1;
- else if (be32_to_cpu(rhead->h_cycle) + 1 !=
- be32_to_cpu(*(__be32 *)ptr))
- return -1;
+ if ((*read_type == FULL_READ) ||
+ (be32_to_cpu(rhead->h_cycle) + 1 !=
+ be32_to_cpu(*(__be32 *)ptr))) {
+ free(buf);
+ return -1;
+ }
}
}