"Das U-Boot" Source Tree
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fs/erofs: Fix realloc error handling

If realloc failed, raw was not freed and thus memory
was leaked.

Signed-off-by: Francois Berder <fberder@outlook.fr>

authored by

Francois Berder and committed by
Tom Rini
1c1be32c 00e1fed9

+5 -2
+5 -2
fs/erofs/data.c
··· 319 319 } 320 320 321 321 if (map.m_plen > bufsize) { 322 + char *tmp; 323 + 322 324 bufsize = map.m_plen; 323 - raw = realloc(raw, bufsize); 324 - if (!raw) { 325 + tmp = realloc(raw, bufsize); 326 + if (!tmp) { 325 327 ret = -ENOMEM; 326 328 break; 327 329 } 330 + raw = tmp; 328 331 } 329 332 330 333 ret = z_erofs_read_one_data(inode, &map, raw,