Skip to content

Commit

Permalink
i915: fix error path leak in intel_sdvo_write_cmd
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Alan Cox authored and Daniel Vetter committed Jul 26, 2012
1 parent af447bd commit 0274df3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/gpu/drm/i915/intel_sdvo.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,13 +444,16 @@ static bool intel_sdvo_write_cmd(struct intel_sdvo *intel_sdvo, u8 cmd,
struct i2c_msg *msgs;
int i, ret = true;

/* Would be simpler to allocate both in one go ? */
buf = (u8 *)kzalloc(args_len * 2 + 2, GFP_KERNEL);
if (!buf)
return false;

msgs = kcalloc(args_len + 3, sizeof(*msgs), GFP_KERNEL);
if (!msgs)
if (!msgs) {
kfree(buf);
return false;
}

intel_sdvo_debug_write(intel_sdvo, cmd, args, args_len);

Expand Down

0 comments on commit 0274df3

Please sign in to comment.