Skip to content

Commit 71dd6cd

Browse files
hoshinolinamarcan
authored andcommitted
drm/apple: Fix parse_string() memory leaks
Signed-off-by: Asahi Lina <lina@asahilina.net>
1 parent db4db4d commit 71dd6cd

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

drivers/gpu/drm/apple/parser.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,9 @@ static int parse_dimension(struct dcp_parse_ctx *handle, struct dimension *dim)
243243
else
244244
skip(it.handle);
245245

246+
if (!IS_ERR_OR_NULL(key))
247+
kfree(key);
248+
246249
if (ret)
247250
return ret;
248251
}
@@ -298,6 +301,9 @@ static int parse_color_modes(struct dcp_parse_ctx *handle, s64 *preferred_id)
298301
else
299302
skip(it.handle);
300303

304+
if (!IS_ERR_OR_NULL(key))
305+
kfree(key);
306+
301307
if (ret)
302308
return ret;
303309
}
@@ -381,6 +387,9 @@ static int parse_mode(struct dcp_parse_ctx *handle,
381387
else
382388
skip(it.handle);
383389

390+
if (!IS_ERR_OR_NULL(key))
391+
kfree(key);
392+
384393
if (ret)
385394
return ret;
386395
}
@@ -511,6 +520,9 @@ int parse_display_attributes(struct dcp_parse_ctx *handle, int *width_mm,
511520
else
512521
skip(it.handle);
513522

523+
if (!IS_ERR_OR_NULL(key))
524+
kfree(key);
525+
514526
if (ret)
515527
return ret;
516528
}

0 commit comments

Comments
 (0)