[patch] target_read_string, potential memory leak.

msnyder
2007-08-05T03:29:11Z

[-- Attachment #1: Type: text/plain, Size: 132 bytes --]

OK -- it would be pretty stupid to call target_read_string without
passing it a buffer, but if we're going to check it for null...

[-- Attachment #2: 137.txt --]
[-- Type: text/plain, Size: 567 bytes --]

2007-08-04 Michael Snyder <msnyder@access-company.com>

* target.c (target_read_string): Potential memory leak.

Index: target.c
===================================================================
RCS file: /cvs/src/src/gdb/target.c,v
retrieving revision 1.145
diff -p -r1.145 target.c
*** target.c 24 Jul 2007 12:49:24 -0000 1.145
--- target.c 5 Aug 2007 03:25:25 -0000
*************** done:
*** 972,977 ****
--- 972,980 ----
*errnop = errcode;
if (string != NULL)
*string = buffer;
+ else
+ xfree (buffer);
+
return nbytes_read;
}