Skip to content

Commit de9494f

Browse files
committed
Fixed OOM (tests/experimental/locale_float.phpt)
1 parent 513c091 commit de9494f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

php_memcached.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -829,18 +829,18 @@ zend_bool s_compress_value (php_memc_compression_type compression_type, zend_str
829829

830830
if (!compress_status) {
831831
php_error_docref(NULL, E_WARNING, "could not compress value");
832-
MEMC_VAL_DEL_FLAG(*flags, MEMC_VAL_COMPRESSED);
833832
efree (buffer);
834833
return 0;
835834
}
836835

837836
/* This means the value was too small to be compressed, still a success */
838837
if (compressed_size > (ZSTR_LEN(payload) * MEMC_G(compression_factor))) {
839-
MEMC_VAL_DEL_FLAG(*flags, MEMC_VAL_COMPRESSED);
840838
efree (buffer);
841839
return 1;
842840
}
843841

842+
MEMC_VAL_SET_FLAG(*flags, MEMC_VAL_COMPRESSED);
843+
844844
payload = zend_string_realloc(payload, compressed_size + sizeof(uint32_t), 0);
845845

846846
/* Copy the uin32_t at the beginning */
@@ -1005,7 +1005,6 @@ zend_string *s_zval_to_payload(php_memc_object_t *intern, zval *value, uint32_t
10051005
zend_string_release(payload);
10061006
return NULL;
10071007
}
1008-
MEMC_VAL_SET_FLAG(*flags, MEMC_VAL_COMPRESSED);
10091008
}
10101009

10111010
if (memc_user_data->set_udf_flags >= 0) {

0 commit comments

Comments
 (0)