apps/examples/testcase: Fix multiple freeing of buffers
Fix warning for multiple times fd close and freeing of buffers.
@@ -40,13 +40,16 @@ static inline void close_fds(int *fds, int count)
/* Close given file descriptor and free the buffer */
#define cleanup(fd, buf) \
do {\
+ if (fd > 0)\
close(fd);\
+ if (buf)\
free(buf);\
} while (0)
/* Close the file descriptor and unregister the bch device */
#define clean_unreg(fd) \
do {\
+ if (fd > 0)\
close(fd);\
bchdev_unregister("/dev/tmpbchdevrw");\
} while (0)
