]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:lib: Fix use_after_free: Using freed pointer "p"
authorPavel Filipenský <pfilipen@redhat.com>
Mon, 23 May 2022 10:57:42 +0000 (12:57 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 23 May 2022 18:25:28 +0000 (18:25 +0000)
Found by covscan.

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/netapi/examples/common.c

index 66b2bd3b6d0b13bd6c9404a11194dab2b62d6b08..72d7150b4eaee7a90cedcc2cc3343f90777ac030 100644 (file)
@@ -140,6 +140,7 @@ char *netapi_read_file(const char *filename, uint32_t *psize)
                tmp = realloc(p, sizeof(char) * newbufsize);
                if (tmp == NULL) {
                        free(p);
+                       p = NULL;
                        goto fail;
                }
                p = tmp;