Fix: elf: leaks on error paths
[lttng-ust.git] / liblttng-ust / lttng-ust-elf.c
index 9186ee90cb7ab093a27b8eabcc03370076e5a3a8..ce58539e67880e853224a862c6aaed3ca6094b7a 100644 (file)
@@ -118,7 +118,7 @@ struct lttng_ust_elf_shdr *lttng_ust_elf_get_shdr(struct lttng_ust_elf *elf,
        }
 
        offset = (off_t) elf->ehdr->e_shoff
-               + (off_t) index * elf->ehdr->e_shentsize;
+                       + (off_t) index * elf->ehdr->e_shentsize;
        if (lseek(elf->fd, offset, SEEK_SET) < 0) {
                goto error;
        }
@@ -478,6 +478,7 @@ int lttng_ust_elf_get_build_id_from_segment(
        *found = _found;
        return 0;
 error:
+       free(_build_id);
        return -1;
 }
 
@@ -624,10 +625,8 @@ end:
        return 0;
 
 error:
-       if (section_name) {
-               free(section_name);
-       }
-
+       free(_filename);
+       free(section_name);
        return -1;
 }
 
This page took 0.02401 seconds and 4 git commands to generate.