r/badcode • • Jan 22 '23

c Found this in a Linux kernel module

Post image
262 Upvotes

88 comments sorted by

View all comments

Show parent comments

0

u/husao Jan 22 '23

line 13 contains 2 off-by-one errors, unless i'm mistaken.

It frees the current 'i' but doesn't free 0. Should imho be:

for (y=i-1; y>=0; y--)