Skip to content

Commit

Permalink
strdup
Browse files Browse the repository at this point in the history
  • Loading branch information
sj6219 committed Sep 8, 2022
1 parent 86cbe43 commit f47c5e1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/blackwhitelist.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static int add_hostname(const char *host) {
char *host_c = NULL;

if (!check_get_hostname(host)) {
host_c = _strdup(host);
host_c = strdup(host);
tmp_record->host = host_c;
HASH_ADD_KEYPTR(hh, blackwhitelist, tmp_record->host,
strlen(tmp_record->host), tmp_record);
Expand Down
6 changes: 3 additions & 3 deletions src/goodbyedpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -622,9 +622,9 @@ int main(int argc, char *argv[]) {
}

if (filter_string == NULL)
filter_string = _strdup(FILTER_STRING_TEMPLATE);
filter_string = strdup(FILTER_STRING_TEMPLATE);
if (filter_passive_string == NULL)
filter_passive_string = _strdup(FILTER_PASSIVE_STRING_TEMPLATE);
filter_passive_string = strdup(FILTER_PASSIVE_STRING_TEMPLATE);

printf(
"GoodbyeDPI " GOODBYEDPI_VERSION
Expand Down Expand Up @@ -827,7 +827,7 @@ int main(int argc, char *argv[]) {
optarg = argv[optind];

if (optarg) {
char *autottl_copy = _strdup(optarg);
char *autottl_copy = strdup(optarg);
if (strchr(autottl_copy, '-')) {
// token "-" found, start X-Y parser
char *autottl_current = strtok(autottl_copy, "-");
Expand Down
2 changes: 2 additions & 0 deletions src/goodbyedpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@

int main(int argc, char *argv[]);
void deinit_all();

#define strdup _strdup
2 changes: 1 addition & 1 deletion src/service.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ int service_register(int argc, char *argv[])
service_argc = argc;
service_argv = calloc((size_t)(argc + 1), sizeof(void*));
for (i = 0; i < argc; i++) {
service_argv[i] = _strdup(argv[i]);
service_argv[i] = strdup(argv[i]);
}
}

Expand Down

0 comments on commit f47c5e1

Please sign in to comment.