Skip to content

Commit d7cf2fc

Browse files
committed
lustre_file_open: Fix memory leak
Signed-off-by: Bert Wesarg <bert.wesarg@tu-dresden.de>
1 parent 26c136a commit d7cf2fc

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
@@ -134,19 +134,21 @@ mca_fs_lustre_file_open (struct ompi_communicator_t *comm,
134134
}
135135

136136
lump = alloc_lum();
137-
if (NULL == lump ){
137+
if (NULL == lump) {
138138
fprintf(stderr,"Cannot allocate memory for extracting stripe size\n");
139139
return OMPI_ERROR;
140140
}
141141
rc = llapi_file_get_stripe(filename, lump);
142142
if (rc != 0) {
143143
opal_output(1, "get_stripe failed: %d (%s)\n", errno, strerror(errno));
144+
free(lump);
144145
return OMPI_ERROR;
145146
}
146147
fh->f_stripe_size = lump->lmm_stripe_size;
147148
fh->f_stripe_count = lump->lmm_stripe_count;
148149
fh->f_fs_block_size = lump->lmm_stripe_size;
149150
fh->f_flags |= OMPIO_LOCK_NEVER;
150-
151+
free(lump);
152+
151153
return OMPI_SUCCESS;
152154
}

0 commit comments

Comments
 (0)