]> granicus.if.org Git - python/commitdiff
Prevent memory leak on error.
authorNeal Norwitz <nnorwitz@gmail.com>
Wed, 2 Aug 2006 04:27:11 +0000 (04:27 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Wed, 2 Aug 2006 04:27:11 +0000 (04:27 +0000)
Reported by Klocwork #36

Modules/cPickle.c

index 9d979def88968f6ad5b3279719580e37494ddcf2..24c98ccb225602ff51ce27c95986a10d079137f2 100644 (file)
@@ -3401,11 +3401,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: