Skip to content

Commit

Permalink
Fix couple of issue found in compile testing
Browse files Browse the repository at this point in the history
  • Loading branch information
RH-steve-grubb committed Oct 1, 2019
1 parent 3701ad9 commit daaf0ad
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lookup_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <linux/capability.h>
#include <strings.h>
#include <stdio.h>
#include <stdlib.h> // free


#define hidden __attribute__ ((visibility ("hidden")))
Expand Down Expand Up @@ -115,13 +116,13 @@ const char *capng_capability_to_name(unsigned int capability)

ptr = capng_lookup_number(captab, captab_msgstr.str,
CAP_NG_CAPABILITY_NAMES, capability);
if (ptr == NULL) // This leaks memory, but should almost never be used
if (ptr == NULL) { // This leaks memory, but should almost never be used
free(ptr2);
if (asprintf(&ptr2, "cap_%u", capability) < 0)
ptr = NULL;
else
ptr = ptr2;

}
return ptr;
}

0 comments on commit daaf0ad

Please sign in to comment.