Skip to content

Commit

Permalink
firehose: Always free response xmlDoc
Browse files Browse the repository at this point in the history
The xmlDoc returned by firehose_response_parse() needs to be freed
regardless of what message it contains.

Signed-off-by: Bjorn Andersson <[email protected]>
  • Loading branch information
quic-bjorande authored and Konrad Dybcio committed Jun 7, 2024
1 parent b761963 commit c647d6d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions firehose.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ static int firehose_read(struct qdl_device *qdl, int timeout_ms,
char buf[4096];
xmlNode *node;
int error;
int ret = -ENXIO;
int ret = -EAGAIN;
int n;
struct timeval timeout;
struct timeval now;
Expand All @@ -139,7 +139,7 @@ static int firehose_read(struct qdl_device *qdl, int timeout_ms,
gettimeofday(&now, NULL);
timeradd(&now, &delta, &timeout);

for (;;) {
do {
n = qdl_read(qdl, buf, sizeof(buf), 100);
if (n < 0) {
gettimeofday(&now, NULL);
Expand All @@ -160,11 +160,8 @@ static int firehose_read(struct qdl_device *qdl, int timeout_ms,
}

ret = response_parser(node, data);
if (ret != -EAGAIN)
break;

xmlFreeDoc(node->doc);
}
} while (ret == -EAGAIN);

return ret;
}
Expand Down

0 comments on commit c647d6d

Please sign in to comment.