diff options
| -rw-r--r-- | src/sp_utils.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/sp_utils.c b/src/sp_utils.c index 81941f7..6612e6c 100644 --- a/src/sp_utils.c +++ b/src/sp_utils.c | |||
| @@ -284,11 +284,9 @@ bool sp_match_array_key(const zval* zv, const char* to_match, const pcre* rx) { | |||
| 284 | return true; | 284 | return true; |
| 285 | } | 285 | } |
| 286 | } else { | 286 | } else { |
| 287 | char* idx_str = NULL; | 287 | char* idx_str = emalloc(snprintf(NULL, 0, "%lu", idx) + 1); |
| 288 | 288 | ||
| 289 | // Could use a log. | 289 | sprintf(idx_str, "%lu", idx); // This could use a log. |
| 290 | idx_str = emalloc(snprintf(NULL, 0, "%lu", idx)); | ||
| 291 | sprintf(idx_str, "%lu", idx); | ||
| 292 | if (sp_match_value(idx_str, to_match, rx)) { | 290 | if (sp_match_value(idx_str, to_match, rx)) { |
| 293 | efree(idx_str); | 291 | efree(idx_str); |
| 294 | return true; | 292 | return true; |
