```
imei_ = imei : ""  ? imei;
free(imei);
```

I think it is safe to free a NULL char*, so free(imei) always.