On Wed, 7 Jun 2023 09:20:30 -0700
Srikanth Yalavarthi <syalavar...@marvell.com> wrote:
The normal case leaks the open file descriptor

+
+       file_map = mmap(0, file_stat.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
+       if (file_map == MAP_FAILED) {
+               ml_err("Failed to map file: %s\n", file);
+               ret = -errno;
+               goto error;
+       }
+
+       rte_memcpy(file_buffer, file_map, file_stat.st_size);
+       munmap(file_map, file_stat.st_size);
+
+       *size = file_stat.st_size;
+       *buffer = file_buffer;
+
+       return 0;

Missing close()

> +     if (buffer)
> +             free(buffer);
> +

Another needless if()

Reply via email to