From ef8fb1680750a4bf8a9636357e23fb6edf4fd7e0 Mon Sep 17 00:00:00 2001 From: Mamoru TASAKA Date: Dec 10 2020 06:11:59 +0000 Subject: 2 changes * asm6502.c/immediate: readd free() call accidentally removed during gcc warnings fix * workaround to regenerate po --- diff --git a/xscreensaver-5.45-0002-asm6502.c-immediate-readd-free-call-accidentally-rem.patch b/xscreensaver-5.45-0002-asm6502.c-immediate-readd-free-call-accidentally-rem.patch new file mode 100644 index 0000000..c398c14 --- /dev/null +++ b/xscreensaver-5.45-0002-asm6502.c-immediate-readd-free-call-accidentally-rem.patch @@ -0,0 +1,42 @@ +From bc93d94efe27f6a42cfe1d5c5c5723565f3930de Mon Sep 17 00:00:00 2001 +From: Mamoru TASAKA +Date: Thu, 10 Dec 2020 11:45:51 +0900 +Subject: [PATCH] asm6502.c/immediate: readd free() call accidentally removed + during gcc warnings fix + +valgrind detects the following leak: + +==200428== 4,480 bytes in 56 blocks are definitely lost in loss record 307 of 310 +==200428== at 0x483BAE9: calloc (vg_replace_malloc.c:760) +==200428== by 0x1122AB: UnknownInlinedFun (asm6502.c:115) +==200428== by 0x1122AB: UnknownInlinedFun (asm6502.c:1411) +==200428== by 0x1122AB: UnknownInlinedFun (asm6502.c:1576) +==200428== by 0x1122AB: UnknownInlinedFun (asm6502.c:1652) +==200428== by 0x1122AB: compileCode (asm6502.c:2028) +==200428== by 0x118602: UnknownInlinedFun (asm6502.c:2230) +==200428== by 0x118602: UnknownInlinedFun (m6502.c:93) +==200428== by 0x118602: m6502_draw (m6502.c:230) +==200428== by 0x10D9D7: UnknownInlinedFun (screenhack.c:597) +==200428== by 0x10D9D7: main (screenhack.c:991) + +During gcc warnings fix (about -Wstringop), strncpy() is changed to sprintf, but the following +free() should not be removed, otherwise m6502 will leak memory. +--- + hacks/asm6502.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/hacks/asm6502.c b/hacks/asm6502.c +index 1d5c896..dd8a11b 100644 +--- a/hacks/asm6502.c ++++ b/hacks/asm6502.c +@@ -1413,6 +1413,7 @@ static BOOL immediate(char **s, Param *param){ + (*s)++; /* move past < or > */ + if (paramLabel(s, &label)){ + sprintf(param->label, "%.*s", MAX_LABEL_LEN-1, label); ++ free(label); + return TRUE; + } + free(label); +-- +2.29.2 + diff --git a/xscreensaver.spec b/xscreensaver.spec index 1b1141a..c565668 100644 --- a/xscreensaver.spec +++ b/xscreensaver.spec @@ -10,7 +10,7 @@ %define split_getimage 1 %endif -%define fedora_rel 0.100 +%define fedora_rel 0.101 %global use_clang_as_cc 0 %global use_clang_analyze 0 @@ -95,6 +95,8 @@ Patch3607: xscreensaver-5.36-0007-misc-kill-gcc-warn_unused_result-warning Patch4261: xscreensaver-5.42-0061-open-new-window-for-man-when-using-gnome-terminal.patch # test-password.c: add skel definition for clientmessage_response Patch4501: xscreensaver-5.45-1001-test-password.c-add-skel-definition-for-clientmessa.patch +# asm6502.c/immediate: readd free() call accidentally removed during gcc warnings fix +Patch4502: xscreensaver-5.45-0002-asm6502.c-immediate-readd-free-call-accidentally-rem.patch # # gcc warning cleanup # Some cppcheck cleanup @@ -369,6 +371,7 @@ find . -name \*.c -exec chmod ugo-x {} \; %__cat %PATCH4261 | %__git am %__cat %PATCH4501 | %__git am +%__cat %PATCH4502 | %__git am #%%__cat %PATCH13501 | %%__git am @@ -641,7 +644,18 @@ sed -i driver/XScreenSaver.ad -e "s|$(pwd)/TMPBINDIR/||" %if %{update_po} #( cd po ; make generate_potfiles_in update-po ) # ??? -( cd po ; make generate_potfiles_in ; cp -p POTFILES.in .. ; export srcdir=.. ; make update-po ; rm -f ../POTFILES_in ) +pushd po + make generate_potfiles_in + cp -p POTFILES.in .. + # Workaround for ui file + sed -i ../POTFILES.in POTFILES.in POTFILES \ + -e '\@-demo\.ui@s|^\([ \t]*\)\(.*\)$|\1[type: gettext/glade]\2|' + make xscreensaver.pot srcdir=.. + ( export srcdir=.. ; make update-po ) + rm -f ../POTFILES_in +popd + + ( cp -p ../po/*.po po/) ( ( cd ../po ; git add *.po ; git commit -m "po regenerated" ) || true ) %endif