Coverity scan findings - memleaks, unused vars, potential nullptr dereferences
This commit is contained in:
parent
bf0b3b6522
commit
d293b686e4
@ -69,6 +69,7 @@ signal_handler(int signum, siginfo_t *siginfo, void *ucontext)
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(signame);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
3
pmap.c
3
pmap.c
@ -352,6 +352,9 @@ static void print_extended_maps (FILE *f)
|
|||||||
if (listnode == NULL) {
|
if (listnode == NULL) {
|
||||||
assert(firstmapping == 2);
|
assert(firstmapping == 2);
|
||||||
listnode = calloc(1, sizeof *listnode);
|
listnode = calloc(1, sizeof *listnode);
|
||||||
|
if (listnode == NULL)
|
||||||
|
xerrx(EXIT_FAILURE, _("ERROR: memory allocation failed"));
|
||||||
|
|
||||||
if (listhead == NULL) {
|
if (listhead == NULL) {
|
||||||
assert(listtail == NULL);
|
assert(listtail == NULL);
|
||||||
listhead = listnode;
|
listhead = listnode;
|
||||||
|
5
watch.c
5
watch.c
@ -125,8 +125,6 @@ static void reset_ansi(void)
|
|||||||
|
|
||||||
static void init_ansi_colors(void)
|
static void init_ansi_colors(void)
|
||||||
{
|
{
|
||||||
int color;
|
|
||||||
|
|
||||||
short ncurses_colors[] = {
|
short ncurses_colors[] = {
|
||||||
-1, COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_YELLOW,
|
-1, COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_YELLOW,
|
||||||
COLOR_BLUE, COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE
|
COLOR_BLUE, COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE
|
||||||
@ -173,6 +171,9 @@ static int process_ansi_color_escape_sequence(char** escape_sequence) {
|
|||||||
// ESC[ 48;2;⟨r⟩;⟨g⟩;⟨b⟩ m Select RGB background color
|
// ESC[ 48;2;⟨r⟩;⟨g⟩;⟨b⟩ m Select RGB background color
|
||||||
int num;
|
int num;
|
||||||
|
|
||||||
|
if (!escape_sequence)
|
||||||
|
return 0; /* avoid NULLPTR dereference, return "not understood" */
|
||||||
|
|
||||||
if ((*escape_sequence)[0] != ';')
|
if ((*escape_sequence)[0] != ';')
|
||||||
return 0; /* not understood */
|
return 0; /* not understood */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user