Merge "hal: fix a bug introduced as part of changes done for fixing memroy leak"