We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 45d9c42 commit 116977aCopy full SHA for 116977a
src/lib/exercises/src/hackerrank/warmup/time_conversion.c
@@ -51,12 +51,14 @@ char *HACKERRANK_WARMUP_timeConversion(const char *s) {
51
52
char time_str[TIME_SIZE];
53
strcpy(time_str, s);
54
- const char *temp_time_str;
+ char *temp_time_str;
55
unsigned long time_str_len = strlen(time_str);
56
temp_time_str = HACKERRANK_WARMUP_getLast(time_str, time_str_len - 2);
57
strcpy(time_str, temp_time_str);
58
+ free(temp_time_str);
59
temp_time_str = HACKERRANK_WARMUP_getFirst(time_str, time_str_len - 2);
60
61
62
63
char *endptr;
64
long hour = strtol(hour_str, &endptr, 10);
0 commit comments