Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Commit

Permalink
common/platform-linux: fix leaking on parse_mount_point_file error
Browse files Browse the repository at this point in the history
It could leaks a buffer.

Signed-off-by: Bruno Dilly <bruno.dilly@intel.com>
  • Loading branch information
bdilly committed Nov 10, 2015
1 parent 9c7ba25 commit a7d4334
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/common/sol-platform-linux-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ parse_mount_point_file(const char *file, struct sol_ptr_vector *vector)
struct mntent mbuf;
struct mntent *m;
char strings[4096];
struct sol_buffer *itr;
struct sol_buffer *itr, *buff = NULL;
uint16_t i;
FILE *tab = setmntent(file, "re");

Expand All @@ -327,7 +327,6 @@ parse_mount_point_file(const char *file, struct sol_ptr_vector *vector)
}

while ((m = getmntent_r(tab, &mbuf, strings, sizeof(strings)))) {
struct sol_buffer *buff = NULL;
int r;

buff = sol_buffer_new();
Expand All @@ -343,6 +342,7 @@ parse_mount_point_file(const char *file, struct sol_ptr_vector *vector)
return 0;

err:
sol_buffer_fini(buff);
SOL_PTR_VECTOR_FOREACH_IDX (vector, itr, i) {
sol_buffer_fini(itr);
}
Expand Down

0 comments on commit a7d4334

Please sign in to comment.