]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[Backport r51033 | neal.norwitz]
authorAndrew M. Kuchling <amk@amk.ca>
Tue, 3 Oct 2006 19:30:04 +0000 (19:30 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Tue, 3 Oct 2006 19:30:04 +0000 (19:30 +0000)
Prevent memory leak on error.

Reported by Klocwork #36

Modules/cPickle.c

index 0b36e7ef03d6a80842f7da21796c8aa7e1904003..df564d44b3b59859e910c0c2c38563ae7fda36ee 100644 (file)
@@ -3394,11 +3394,11 @@ load_string(Unpicklerobject *self)
        /********************************************/
 
        str = PyString_DecodeEscape(p, len, NULL, 0, NULL);
+       free(s);
        if (str) {
                PDATA_PUSH(self->stack, str, -1);
                res = 0;
        }
-       free(s);
        return res;
 
   insecure: