Skip to content

Commit

Permalink
xode_from.c: close handler in case of error
Browse files Browse the repository at this point in the history
Fixes Coverity CID 40812

(cherry picked from commit 616e1bd032ebcd6d676795bb28915d1d8730525a)
  • Loading branch information
razvancrainea committed Nov 14, 2016
1 parent 3e48a3d commit f96d679
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion modules/jabber/xode_from.c
Expand Up @@ -220,8 +220,10 @@ int xode_to_file(char *file, xode node)

doc = xode_to_str(node);
i = write(fd,doc,strlen(doc));
if(i < 0)
if(i < 0) {
close(fd);
return -1;
}

close(fd);
return 1;
Expand Down
4 changes: 3 additions & 1 deletion modules/xmpp/xode_from.c
Expand Up @@ -220,8 +220,10 @@ int xode_to_file(char *file, xode node)

doc = xode_to_str(node);
i = write(fd,doc,strlen(doc));
if(i < 0)
if(i < 0) {
close(fd);
return -1;
}

close(fd);
return 1;
Expand Down

0 comments on commit f96d679

Please sign in to comment.