Skip to content

Commit

Permalink
sds: on destroy, validate NULL
Browse files Browse the repository at this point in the history
Signed-off-by: Eduardo Silva <[email protected]>
  • Loading branch information
edsiper committed Jun 20, 2018
1 parent e1bb870 commit 38a0d83
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/fluent-bit/flb_sds.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ flb_sds_t flb_sds_cat(flb_sds_t s, char *str, int len);
flb_sds_t flb_sds_increase(flb_sds_t s, size_t len);
flb_sds_t flb_sds_copy(flb_sds_t s, char *str, int len);

int flb_sds_destroy(flb_sds_t s);
void flb_sds_destroy(flb_sds_t s);

#endif
8 changes: 5 additions & 3 deletions src/flb_sds.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,14 @@ flb_sds_t flb_sds_copy(flb_sds_t s, char *str, int len)
return s;
}

int flb_sds_destroy(flb_sds_t s)
void flb_sds_destroy(flb_sds_t s)
{
struct flb_sds *head;

if (!s) {
return;
}

head = FLB_SDS_HEADER(s);
flb_free(head);

return 0;
}

0 comments on commit 38a0d83

Please sign in to comment.