fix memory leaking

There is a possible memory leaking when lo is allocated but
the lo->name is not. In this case, we should free the lo and then return

original change I475968bd570a113c9f61f02b974d57d1caaa0236

picked from: https://android-review.googlesource.com/#/c/23450/

Change-Id: I21dd3267fa2521578d93f7b1a7bc2a6726de15ac