resolved invalid buffer free issue

This commit is contained in:
2016-12-25 17:50:18 +08:00
parent 0c2752f87d
commit e4d50e91c2
4 changed files with 12 additions and 39 deletions

View File

@@ -44,5 +44,5 @@ set(SOURCE_FILES_SHARED_LIB
irda_utils.c
include/irda_utils.h)
# add_executable(irda_decoder ${SOURCE_FILES_EXECUTABLE})
add_library(irda_decoder SHARED ${SOURCE_FILES_SHARED_LIB})
add_executable(irda_decoder ${SOURCE_FILES_EXECUTABLE})
# add_library(irda_decoder SHARED ${SOURCE_FILES_SHARED_LIB})

View File

@@ -335,6 +335,7 @@ INT8 irda_ac_file_open(const char* file_name)
if (NULL == binary_content)
{
IR_PRINTF("\nfailed to alloc memory for binary\n");
fclose(stream);
return IR_DECODE_FAILED;
}
@@ -759,10 +760,9 @@ INT8 irda_ac_lib_parse()
#if defined BOARD_PC
void irda_lib_free_inner_buffer()
{
if (NULL != pirda_buffer->data) {
irda_free(pirda_buffer->data);
pirda_buffer->len = 0;
pirda_buffer->offset = 0;
if (NULL != binary_content) {
irda_free(binary_content);
binary_content = NULL;
}
}
#endif
@@ -1252,6 +1252,12 @@ INT8 irda_tv_file_open(const char* file_name)
IR_PRINTF("length of binary = %d\n", (int)binary_length);
binary_content = (UINT8*) irda_malloc(binary_length);
if (NULL == binary_content)
{
IR_PRINTF("\nfailed to alloc memory for binary\n");
fclose(stream);
return IR_DECODE_FAILED;
}
fseek(stream, 0, SEEK_SET);
ret = fread(binary_content, binary_length, 1, stream);

Binary file not shown.

View File

@@ -1,33 +0,0 @@
#!/usr/bin/env bash
SOURCE="."
TARGET="$POEM_APPLICATION/irext_console"
MODULE_API="./web/api_doc/js/"
function deploy()
{
for file in `ls $1`
do
echo $file
if [ -d $1"/"$file ]
then
deploy $1"/"$file
else
if [ $1"/" = $MODULE_API ]
then
echo "compiling file" $1"/"$file
mkdir -p $TARGET$1
java -jar compiler.jar --js $1"/"$file --js_output_file $TARGET$1"/"$file
else
echo "copying file" $1"/"$file
mkdir -p $TARGET$1
cp -v -f $1"/"$file $TARGET$1"/"$file
fi
fi
done
}
INIT_PATH="./"
#rm -rf $TARGET
deploy $INIT_PATH
mv $TARGET$INIT_PATH $TARGET
#cp $SOURCE"/"run.sh $TARGET