Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 82e01bb

Browse filesBrowse files
QuLogicMeeseeksDev[bot]
authored andcommitted
Backport PR #13288: Fix potential memory leak
1 parent d730751 commit 82e01bb
Copy full SHA for 82e01bb

File tree

Expand file treeCollapse file tree

1 file changed

+4
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-2
lines changed

‎src/_path.h

Copy file name to clipboardExpand all lines: src/_path.h
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,12 +1053,14 @@ char *__append_to_string(char *p, char **buffer, size_t *buffersize,
10531053
return NULL;
10541054
}
10551055
if ((size_t)(p - *buffer) >= *buffersize) {
1056+
char *newbuffer;
10561057
ptrdiff_t diff = p - *buffer;
10571058
*buffersize *= 2;
1058-
*buffer = (char *)realloc(*buffer, *buffersize);
1059-
if (*buffer == NULL) {
1059+
newbuffer = (char *)realloc(*buffer, *buffersize);
1060+
if (newbuffer == NULL) {
10601061
return NULL;
10611062
}
1063+
*buffer = newbuffer;
10621064
p = *buffer + diff;
10631065
}
10641066

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.