Skip to content

Commit

Permalink
basic/alloc-util: also reset the cleaned-up variable in freep()
Browse files Browse the repository at this point in the history
freep() has it's own definition, so I missed it in fd421c4.

Again, there is a small growth, but the compiler should be able to optimize it away:
-Dbuildtype=debug:

-rwxrwxr-x 1 zbyszek zbyszek 4106816 Feb 19 12:52 build/libsystemd.so.0.30.0
-rwxrwxr-x 1 zbyszek zbyszek 7492952 Feb 19 12:52 build/src/shared/libsystemd-shared-247.so
-rwxrwxr-x 1 zbyszek zbyszek 4472624 Feb 19 12:53 build/systemd

-rwxrwxr-x 1 zbyszek zbyszek 4107056 Feb 19 13:03 build/libsystemd.so.0.30.0
-rwxrwxr-x 1 zbyszek zbyszek 7493480 Feb 19 13:03 build/src/shared/libsystemd-shared-247.so
-rwxrwxr-x 1 zbyszek zbyszek 4472760 Feb 19 13:03 build/systemd

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=31055.
  • Loading branch information
keszybz authored and poettering committed Feb 19, 2021
1 parent 3d81e41 commit 5800f0f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/basic/alloc-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void* memdup_suffix0(const void *p, size_t l); /* We can't use _alloc_() here, s
})

static inline void freep(void *p) {
free(*(void**) p);
*(void**)p = mfree(*(void**) p);
}

#define _cleanup_free_ _cleanup_(freep)
Expand Down
Binary file not shown.

0 comments on commit 5800f0f

Please sign in to comment.