Flashlight problem on Android
I have got a technique to deal with this issue.

I have booted my phone into recovery mode and wiped android's cache partition from there. Since then, the flashlight issue seems to have flown away.
I mean, now the flashlight is not automatically turning itself off.

@Zillinium, I think you should also try this method to deal with your issue. If that doesn't work, a system update or factory reset might do the trick, if there is no hardware problem.