v4l2: fix the memory leak
commit 9985432a82e6700cf9759f413ecaecbf617318cb check for fh->dev being NULL before kzalloc to fix the memory leak Change-Id: I3377ef39297f63c692aa5451d2bdbe327e2df18a
This commit is contained in:
committed by
Iliyan Malchev
parent
eed21b25b7
commit
21cfe24ba2
@@ -227,6 +227,11 @@ int v4l2_event_subscribe(struct v4l2_fh *fh,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!fh->vdev) {
|
||||
pr_err("%s: fh->vdev is NULL\n", __func__);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
sev = kzalloc(sizeof(*sev) + sizeof(struct v4l2_kevent) * elems, GFP_KERNEL);
|
||||
if (!sev)
|
||||
return -ENOMEM;
|
||||
@@ -242,11 +247,6 @@ int v4l2_event_subscribe(struct v4l2_fh *fh,
|
||||
sev->merge = ctrls_merge;
|
||||
}
|
||||
|
||||
if (!fh->vdev) {
|
||||
pr_err("%s: fh->vdev is NULL\n", __func__);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&fh->vdev->fh_lock, flags);
|
||||
found_ev = v4l2_event_subscribed(fh, sub->type, sub->id);
|
||||
if (!found_ev)
|
||||
|
||||
Reference in New Issue
Block a user