mirror of
https://github.com/radareorg/radare2.git
synced 2024-10-08 02:53:29 +00:00
Fix memory leak in /ad/ using r_regex api wrongly ##search (#16537)
* /ad/ in /bin/ls ate 9 extra MB that was never freed * This is about 400 bytes for each instruction disassembled
This commit is contained in:
parent
63e8984ab8
commit
fdb75d3bf9
@ -206,10 +206,8 @@ R_API RList *r_core_asm_strsearch(RCore *core, const char *input, ut64 from, ut6
|
||||
} else if (!regexp) {
|
||||
matches = strstr (opst, tokens[matchcount]) != NULL;
|
||||
} else {
|
||||
rx = r_regex_new (tokens[matchcount], "");
|
||||
if (r_regex_comp (rx, tokens[matchcount], R_REGEX_EXTENDED|R_REGEX_NOSUB) == 0) {
|
||||
matches = r_regex_exec (rx, opst, 0, 0, 0) == 0;
|
||||
}
|
||||
rx = r_regex_new (tokens[matchcount], "es");
|
||||
matches = r_regex_exec (rx, opst, 0, 0, 0) == 0;
|
||||
r_regex_free (rx);
|
||||
}
|
||||
}
|
||||
|
@ -158,9 +158,8 @@ R_API int r_regex_match (const char *pattern, const char *flags, const char *tex
|
||||
#endif
|
||||
}
|
||||
|
||||
R_API RRegex *r_regex_new (const char *pattern, const char *flags) {
|
||||
RRegex rx, *r;
|
||||
memset(&rx, 0, sizeof(RRegex));
|
||||
R_API RRegex *r_regex_new(const char *pattern, const char *flags) {
|
||||
RRegex *r, rx = {0};
|
||||
if (r_regex_comp (&rx, pattern, r_regex_flags (flags))) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1,41 +0,0 @@
|
||||
#!/bin/sh
|
||||
NAME=cmd_macros
|
||||
LAST=`curl -s http://ci.rada.re/job/radare2-regressions/ | \
|
||||
perl -ne 's,>,\n,g;print' | \
|
||||
perl -ne 'if (/Last build/) {
|
||||
$str = $_;
|
||||
$str=~/\(\#(\d+)\)/;
|
||||
$str = $1;
|
||||
print $str;
|
||||
}'
|
||||
`
|
||||
|
||||
R2R=/tmp/.r2r.txt
|
||||
R2C=/tmp/.r2c.txt
|
||||
PREV=""
|
||||
PR2REV=""
|
||||
while : ; do
|
||||
[ ${LAST} -lt 0 ] && break
|
||||
echo "+ Testing build $LAST..."
|
||||
curl -s http://ci.rada.re/job/radare2-regressions/${LAST}/consoleText > $R2R
|
||||
R2B=`grep 'Started by upstream project' $R2R | awk '{print $8 }'`
|
||||
curl -s http://ci.rada.re/job/radare2/${R2B}/consoleText > $R2C
|
||||
R2REV=`grep 'Checking out Revision' $R2C | awk '{print $4}'`
|
||||
echo " - radare2 $R2B = $R2REV"
|
||||
REV=`grep 'Checking out Revision' $R2R | awk '{print $4}'`
|
||||
echo " - regression $LAST $REV"
|
||||
grep ${NAME} $R2R | grep -q XX
|
||||
if [ $? != 0 ]; then
|
||||
echo "Passing test found."
|
||||
echo " + LAST=$LAST..$PLAST"
|
||||
echo " + RRREV=$REV..$PREV"
|
||||
echo " + R2REV=$R2REV..$PR2REV"
|
||||
fi
|
||||
PREV=$REV
|
||||
PR2REV=$R2REV
|
||||
PLAST=$LAST
|
||||
LAST=$(($LAST-1))
|
||||
done
|
||||
|
||||
rm -f $R2R $R2C
|
||||
|
Loading…
Reference in New Issue
Block a user