Fix possible error that cause double free
authorJihoon Lee <jhoon.it.lee@samsung.com>
Wed, 20 May 2020 07:32:10 +0000 (16:32 +0900)
committerJijoong Moon <jijoong.moon@samsung.com>
Wed, 20 May 2020 12:10:56 +0000 (21:10 +0900)
commitf5a9e0b53ec6ca37478477036eb7ffa682c3e0f9
treea672bd9384d6e77bd13da00d2f812ad1f0af9b29
parent3709538238aa0a206ff16b269a7452b3205729dc
Fix possible error that cause double free

There is an occasional error from unittest_tizen_capi.

```bash
[ RUN      ] nntrainer_capi_nnmodel.train_with_file_01_p
training
data_buffer made
data_buffer made done
size: 2
data_buffer clear
data_buffer end
double free or corruption (out)
Aborted (core dumped)
```

**Changes proposed in this PR:**
join data buffer threads first before clearing vectors that are
used in the target function to (possibly) prevent double free

**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: Jihoon Lee <jhoon.it.lee@samsung.com>
nntrainer/src/databuffer.cpp