Skip to content

Commit f5cc551

Browse files
authored
Merge pull request #8900 from edgargabriel/pr/lustre-mem-leak-v4.1
v4.1.x: lustre_file_open: Fix memory leak
2 parents dffb717 + 65572f1 commit f5cc551

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ompi/mca/fs/lustre/fs_lustre_file_open.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,19 +132,21 @@ mca_fs_lustre_file_open (struct ompi_communicator_t *comm,
132132
}
133133

134134
lump = alloc_lum();
135-
if (NULL == lump ){
135+
if (NULL == lump) {
136136
fprintf(stderr,"Cannot allocate memory for extracting stripe size\n");
137137
return OMPI_ERROR;
138138
}
139139
rc = llapi_file_get_stripe(filename, lump);
140140
if (rc != 0) {
141141
opal_output(1, "get_stripe failed: %d (%s)\n", errno, strerror(errno));
142+
free(lump);
142143
return OMPI_ERROR;
143144
}
144145
fh->f_stripe_size = lump->lmm_stripe_size;
145146
fh->f_stripe_count = lump->lmm_stripe_count;
146147
fh->f_fs_block_size = lump->lmm_stripe_size;
147148
fh->f_flags |= OMPIO_LOCK_NEVER;
148-
149+
free(lump);
150+
149151
return OMPI_SUCCESS;
150152
}

0 commit comments

Comments
 (0)