nfc: fix a potential memory leak

If `size == 0`, the freshly-allocated ringbuffer_t* won't get freed.
Hoisting the size check to before the allocation should fix this.

Caught by the static analyzer:
system/nfc/utils/ringbuffer.cc:35:41: warning: Potential leak of memory
pointed to by 'p' [clang-analyzer-unix.Malloc]

Bug: None
Test: TreeHugger
Change-Id: I32904a0b8cd4e861e927ad9c74b171cafc86a41d
1 file changed