Correcting a bug

This commit is contained in:
Maxime M 2014-01-13 17:30:25 +01:00
parent 5998cbec8d
commit 772e2bab75

View File

@ -686,9 +686,10 @@ static void *gdbwrap_writememory(gdbwrap_t *desc, la32 linaddr, void *value, uns
uint8_t packetsize;
char *rec, *packet = malloc(bytes + MSG_BUF);
if (!desc || !value)
if (!desc || !value) {
free (packet);
return NULL;
}
snprintf(packet, MSG_BUF, "%s%x%s%x%s", GDBWRAP_MEMWRITE,
linaddr, GDBWRAP_SEP_COMMA, bytes, GDBWRAP_SEP_COLON);
packetsize = strlen(packet);