Uemis downloader: avoid double free

A well intentioned attempt in commit ff860b3c04 ("uemis-downloader -
resource leaks") to fix resource leaks actually introduced a bug.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-04-20 21:34:15 -07:00
parent 82ff9fc9c8
commit 3fb5f84e11

View file

@ -718,8 +718,6 @@ static bool process_raw_buffer(device_data_t *devdata, uint32_t deviceid, char *
/* is it a valid entry or nothing ? */
if (strcmp(tp, "1.0") != 0 || strstr(inbuf, "divelog{1.0{{{{")) {
free(buf);
free(tp);
free(bp);
return false;
}
} else if (strcmp(tp, "dive") == 0) {
@ -727,15 +725,11 @@ static bool process_raw_buffer(device_data_t *devdata, uint32_t deviceid, char *
tp = next_token(&bp);
if (strcmp(tp, "1.0") != 0) {
free(buf);
free(tp);
free(bp);
return false;
}
} else {
/* don't understand the buffer */
free(buf);
free(bp);
free(tp);
return false;
}
if (log) {
@ -749,8 +743,6 @@ static bool process_raw_buffer(device_data_t *devdata, uint32_t deviceid, char *
#endif
/* oops, this one isn't valid, suggest to try the previous one */
free(buf);
free(bp);
free(tp);
return false;
}
}