Fixes small extra free that wasn't being detected for some reason
This commit is contained in:
parent
4b49d6f510
commit
b154e897c5
@ -11,6 +11,7 @@ $(TARGET): $(OBJ)
|
||||
|
||||
debug:
|
||||
gcc -g $(FILES)
|
||||
mv a.out ../build/
|
||||
|
||||
main.o: include/hex.h include/file.h
|
||||
hex.o: include/hex.h
|
||||
|
@ -85,7 +85,7 @@ static void write_offset(int num, FILE* stream)
|
||||
fprintf(stream, "%08d", num);
|
||||
else
|
||||
fprintf(stream, "%08x", num);
|
||||
fprintf(stream, ": %s", GREEN_TEXT_STR);
|
||||
fprintf(stream, ": %s", (flags.coloured) ? GREEN_TEXT_STR : "");
|
||||
}
|
||||
|
||||
static void write_text(char** text, FILE* stream)
|
||||
@ -123,12 +123,12 @@ static void standard_output(char** text, FILE* stream)
|
||||
for (i = 0; i < (flags.cols * 2); i += (flags.octets * 2)) {
|
||||
for (j = 0; j < (flags.octets * 2); j += 2)
|
||||
write_octet(((*text) + i + j)[0], ((*text) + i + j)[1], stream);
|
||||
fprintf(stream, " ");
|
||||
if (!flags.postscript)
|
||||
fprintf(stream, " ");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void display_hex_chunk(hex_chunk_t* chunk, FILE* stream)
|
||||
{
|
||||
if (!flags.postscript && !flags.c_style)
|
||||
|
@ -17,6 +17,7 @@ static struct argp_option options[] = {
|
||||
{"len", 'l', "len", 0, "stop after <len> octets.", 0},
|
||||
{"uppercase", 'u', 0, 0, "use upper case hex letters.", 0},
|
||||
{"decimaloffset", 'd', 0, 0, "show offset in decimal instead of hex.", 0},
|
||||
{"ps", 'p', 0, 0, "output in postscript plain hexdump style.", 0},
|
||||
{0}
|
||||
};
|
||||
|
||||
@ -40,6 +41,9 @@ static error_t parse_opt(int key, char* arg, struct argp_state* state)
|
||||
case 'd':
|
||||
flags->decimaloffset = true;
|
||||
break;
|
||||
case 'p':
|
||||
flags->postscript = true;
|
||||
flags->coloured = false;
|
||||
case ARGP_KEY_ARG:
|
||||
if (state->arg_num >= 2)
|
||||
argp_usage(state);
|
||||
@ -137,10 +141,7 @@ int main(int argc, char* argv[])
|
||||
i = 0;
|
||||
while (lines[i].line != -1)
|
||||
free_hex_chunk(&(lines[i++]));
|
||||
free_hex_chunk(&(lines[i]));
|
||||
|
||||
free(lines);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user