Commit a96ff202 authored by Sergei Golovan's avatar Sergei Golovan Committed by Sergei Golovan

* Replaced ckalloc() call in exp_clib.c by malloc() because using the

    ordinary free() leads to memory corruption after ckalloc() (which is
    a macro for Tcl_Alloc()). See patches/22-segfault-with-stubs.patch
    for segfaulting examples.
parent 98f881af
expect (5.45-2) UNRELEASED; urgency=low
expect (5.45-2) unstable; urgency=low
* NOT RELEASED YET
* Replaced ckalloc() call in exp_clib.c by malloc() because using the
ordinary free() leads to memory corruption after ckalloc() (which is
a macro for Tcl_Alloc()). See patches/22-segfault-with-stubs.patch
for segfaulting examples.
-- Sergei Golovan <sgolovan@debian.org> Wed, 17 Aug 2011 22:21:48 +0400
-- Sergei Golovan <sgolovan@debian.org> Fri, 04 Nov 2011 12:14:05 +0400
expect (5.45-1) unstable; urgency=low
......
......@@ -15,6 +15,26 @@ Example:
while ((datum = getc (pipe)) != EOF)
printf("%c",datum);
}
Example:
#include <stdio.h>
#include "expect.h"
main()
{
int fd = 0;
fd = exp_spawnl("echo", "echo", "Hello User: Whats up?", (char*) 0);
switch (exp_expectl(fd, exp_regexp, "ser:", 1, exp_end)) {
case 1: {
printf("GOT ser:\n");
break;
}
default: {
printf("DEFAULT\n");
return 1;
}
}
printf("Normal Exit\n");
return 0;
}
--- expect-5.45.orig/exp_clib.c
+++ expect-5.45/exp_clib.c
......@@ -31,3 +51,21 @@ Example:
#include "expect.h"
#define TclRegError exp_TclRegError
@@ -389,7 +389,7 @@
FAIL("regexp too big");
/* Allocate space. */
- r = (regexp *)ckalloc(sizeof(regexp) + (unsigned)rcstate->regsize);
+ r = (regexp *)malloc(sizeof(regexp) + (unsigned)rcstate->regsize);
if (r == NULL)
FAIL("out of space");
@@ -399,7 +399,7 @@
rcstate->regcode = r->program;
regc(MAGIC, rcstate);
if (reg(0, &flags, rcstate) == NULL) {
- ckfree ((char*) r);
+ free ((char*) r);
return(NULL);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment