diff options
author | irungentoo <irungentoo@gmail.com> | 2013-08-04 07:24:00 -0700 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-08-04 07:24:00 -0700 |
commit | b4ae32c1c33da1a3063d1a1df4cfb956b5d78563 (patch) | |
tree | 53322d976d7735c4cb3b3a3ddb61678d13e53462 /testing | |
parent | b2622726b1c8f61b39bad01b4fc0dc7e570feb94 (diff) | |
parent | ae8367dc3ee5652a9b10e178ac269cd5cba8797a (diff) |
Merge pull request #313 from CharmlessCoin/bug_fixes
Removed memory leak, thanks to diath for spotting it.
Diffstat (limited to 'testing')
-rw-r--r-- | testing/misc_tools.c | 1 | ||||
-rw-r--r-- | testing/nTox.c | 8 |
2 files changed, 7 insertions, 2 deletions
diff --git a/testing/misc_tools.c b/testing/misc_tools.c index dbaa8b3b..aa546a88 100644 --- a/testing/misc_tools.c +++ b/testing/misc_tools.c | |||
@@ -36,5 +36,6 @@ unsigned char * hex_string_to_bin(char hex_string[]) | |||
36 | int i; | 36 | int i; |
37 | for(i = 0; i < len; ++i, pos+=2) | 37 | for(i = 0; i < len; ++i, pos+=2) |
38 | sscanf(pos,"%2hhx",&val[i]); | 38 | sscanf(pos,"%2hhx",&val[i]); |
39 | |||
39 | return val; | 40 | return val; |
40 | } | 41 | } |
diff --git a/testing/nTox.c b/testing/nTox.c index 15e209a9..9a07ecdc 100644 --- a/testing/nTox.c +++ b/testing/nTox.c | |||
@@ -142,7 +142,9 @@ void line_eval(char *line) | |||
142 | for (i = 0; i < 128; i++) | 142 | for (i = 0; i < 128; i++) |
143 | temp_id[i] = line[i+prompt_offset]; | 143 | temp_id[i] = line[i+prompt_offset]; |
144 | 144 | ||
145 | int num = m_addfriend(hex_string_to_bin(temp_id), (uint8_t*)"Install Gentoo", sizeof("Install Gentoo")); | 145 | unsigned char *bin_string = hex_string_to_bin(temp_id); |
146 | int num = m_addfriend(bin_string, (uint8_t*)"Install Gentoo", sizeof("Install Gentoo")); | ||
147 | free(bin_string); | ||
146 | char numstring[100]; | 148 | char numstring[100]; |
147 | switch (num) { | 149 | switch (num) { |
148 | case -1: | 150 | case -1: |
@@ -456,7 +458,9 @@ int main(int argc, char *argv[]) | |||
456 | else | 458 | else |
457 | exit(1); | 459 | exit(1); |
458 | 460 | ||
459 | DHT_bootstrap(bootstrap_ip_port, hex_string_to_bin(argv[3])); | 461 | unsigned char *binary_string = hex_string_to_bin(argv[3]); |
462 | DHT_bootstrap(bootstrap_ip_port, binary_string); | ||
463 | free(binary_string); | ||
460 | nodelay(stdscr, TRUE); | 464 | nodelay(stdscr, TRUE); |
461 | while(true) { | 465 | while(true) { |
462 | if (on == 0 && DHT_isconnected()) { | 466 | if (on == 0 && DHT_isconnected()) { |