forked from enlightenment/efl
emile: handling memory leak on realloc.
Summary: Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com> Reviewers: cedric Differential Revision: https://phab.enlightenment.org/D3210 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
parent
ac3358b618
commit
444a0b11bc
|
@ -38,7 +38,7 @@ emile_compress(const Eina_Binbuf *data,
|
|||
Emile_Compressor_Type t,
|
||||
Emile_Compressor_Level l)
|
||||
{
|
||||
void *compact;
|
||||
void *compact, *temp;
|
||||
int length;
|
||||
int level = l;
|
||||
Eina_Bool ok = EINA_FALSE;
|
||||
|
@ -55,19 +55,23 @@ emile_compress(const Eina_Binbuf *data,
|
|||
length = LZ4_compress((const char *)eina_binbuf_string_get(data),
|
||||
compact,
|
||||
eina_binbuf_length_get(data));
|
||||
/* It is going to be smaller and should never fail, if it does you are in deep poo. */
|
||||
temp = realloc(compact, length);
|
||||
if (temp) temp = compact;
|
||||
|
||||
if (length > 0)
|
||||
ok = EINA_TRUE;
|
||||
/* It is going to be smaller and should never fail, if it does you are in deep poo. */
|
||||
compact = realloc(compact, length);
|
||||
break;
|
||||
|
||||
case EMILE_LZ4HC:
|
||||
length = LZ4_compressHC((const char *)eina_binbuf_string_get(data),
|
||||
compact,
|
||||
eina_binbuf_length_get(data));
|
||||
temp = realloc(compact, length);
|
||||
if (temp) compact = temp;
|
||||
|
||||
if (length > 0)
|
||||
ok = EINA_TRUE;
|
||||
compact = realloc(compact, length);
|
||||
break;
|
||||
|
||||
case EMILE_ZLIB:
|
||||
|
|
Loading…
Reference in New Issue