qemu: fix use after free
PATCH 1/1 qemu: fix use after free
Commit 99d53fbb69d3e03be61ae10506a304a3d08d792f introduced this, and the compiler indirectly warned about it.
The patch is only compile tested (I don't even know how to reproduce the original problem), but I suppose worth applying regardless.
keymaps.c +4 -7
@@ -56,15 +56,12 @@ typedef struct {static void del_key_range (struct key_range **krp,int code) {struct key_range *kr; -struct key_range *kr_pr; -for (kr = *krp; kr; kr_pr = kr, kr = kr->next) { +while ((kr = *krp) !=NULL ) {if (code >= kr->start && code <= kr->end) { -if (kr == *krp) - *krp = kr->next; -else - kr_pr->next = kr->next; + *krp = kr->next;qemu_free (kr); - } + }else + krp = &kr->next; } }
Commit 99d53fbb69d3e03be61ae10506a304a3d08d792f introduced this, and the compiler indirectly warned about it.
The patch is only compile tested (I don't even know how to reproduce the original problem), but I suppose worth applying regardless.
keymaps.c +4 -7
@@ -56,15 +56,12 @@ typedef struct {static void del_key_range (struct key_range **krp,int code) {struct key_range *kr; -struct key_range *kr_pr; -for (kr = *krp; kr; kr_pr = kr, kr = kr->next) { +while ((kr = *krp) !=NULL ) {if (code >= kr->start && code <= kr->end) { -if (kr == *krp) - *krp = kr->next; -else - kr_pr->next = kr->next; + *krp = kr->next;qemu_free (kr); - } + }else + krp = &kr->next; } }
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Jan Beulich writes ("[Xen-devel] [PATCH] qemu: fix use after free"):
Quoted 5 lines
Commit
99d53fbb69d3e03be61ae10506a304a3d08d792fintroduced this, and the compiler indirectly warned about it.The patch is only compile tested (I don't even know how to reproduce the original problem), but I suppose worth applying regardless.
Well done for spotting this, I have applied your patch.
Ian.