Mark as const

Change-Id: Id0b0f77d88f593975dec4e024ca6ef5c45946128
Avoid possible memory leaks in case of exceptions

Change-Id: I7878d425cea773338799fb784c25039e6b923e47