Free allocated struct after freeing field
Free allocated MtdReadContext after freeing buffer field in struct, not before. Change-Id: I237920dc36115389cd2d6948e7a962dbec22fe56
This commit is contained in:
parent
c5ebf1fba2
commit
862c83bb31
@ -269,8 +269,8 @@ MtdReadContext *mtd_read_partition(const MtdPartition *partition)
|
||||
sprintf(mtddevname, "/dev/mtd/mtd%d", partition->device_index);
|
||||
ctx->fd = open(mtddevname, O_RDONLY);
|
||||
if (ctx->fd < 0) {
|
||||
free(ctx);
|
||||
free(ctx->buffer);
|
||||
free(ctx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user