Fix leak on error in strptime
This commit is contained in:
1 parent
bdaddcf107
commit
18879fb993
2 files changed
+5
-1
No files matched your search
+4
-1
@@ -1280,8 +1280,11 @@ static void set_tm_yday(struct tm *tm) {
|
||||
|
||||
#ifdef HAVE_STRPTIME
|
||||
static jv f_strptime(jq_state *jq, jv a, jv b) {
|
||||
if (jv_get_kind(a) != JV_KIND_STRING || jv_get_kind(b) != JV_KIND_STRING)
|
||||
if (jv_get_kind(a) != JV_KIND_STRING || jv_get_kind(b) != JV_KIND_STRING) {
|
||||
jv_free(a);
|
||||
jv_free(b);
|
||||
return jv_invalid_with_msg(jv_string("strptime/1 requires string inputs and arguments"));
|
||||
}
|
||||
|
||||
struct tm tm;
|
||||
memset(&tm, 0, sizeof(tm));
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
# strptime() is not available on mingw/WIN32
|
||||
[strptime("%Y-%m-%dT%H:%M:%SZ")|(.,mktime)]
|
||||
"2015-03-05T23:51:47Z"
|
||||
[[2015,2,5,23,51,47,4,63],1425599507]
|
||||
|
||||
# Check day-of-week and day of year computations
|
||||
|
||||
Reference in new issue
Block a user