src: fix coverity warning about sizeof

CID: 1520601
CID: 1520602

> In this particular case sizeof (char **) happens to be equal to
sizeof (char *), but this is not a portable assumption.
pull/8479/head
Philippe Antoine 3 years ago committed by Victor Julien
parent 84d1ed58bb
commit c1f615b8d2

@ -1772,7 +1772,7 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
}
} else if (strcmp((long_opts[option_index]).name, "include") == 0) {
if (suri->additional_configs == NULL) {
suri->additional_configs = SCCalloc(2, sizeof(char **));
suri->additional_configs = SCCalloc(2, sizeof(char *));
if (suri->additional_configs == NULL) {
FatalError(
"Failed to allocate memory for additional configuration files: %s",
@ -1783,7 +1783,7 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
for (int i = 0;; i++) {
if (suri->additional_configs[i] == NULL) {
const char **additional_configs =
SCRealloc(suri->additional_configs, (i + 2) * sizeof(char **));
SCRealloc(suri->additional_configs, (i + 2) * sizeof(char *));
if (additional_configs == NULL) {
FatalError("Failed to allocate memory for additional configuration "
"files: %s",

Loading…
Cancel
Save