Call NewHandle/DisposeHandle directly instead of using ORCA/C's malloc/free.

This commit is contained in:
Stephen Heumann 2017-04-16 20:54:18 -05:00
parent fe2680b65a
commit 444fdbee49

9
dsi.c
View File

@ -1,7 +1,7 @@
#pragma noroot #pragma noroot
#include <AppleTalk.h> #include <AppleTalk.h>
#include <stdlib.h> #include <memory.h>
#include <orca.h> #include <orca.h>
#include <tcpip.h> #include <tcpip.h>
#include "dsiproto.h" #include "dsiproto.h"
@ -99,8 +99,9 @@ top:
goto top; goto top;
} else { } else {
// handle data too long // handle data too long
sess->junkBuf = malloc(dataLength); sess->junkBuf = *NewHandle(dataLength,
if (sess->junkBuf == NULL) { userid(), attrFixed, 0);
if (toolerror() || sess->junkBuf == NULL) {
FlagFatalError(sess, atMemoryErr); FlagFatalError(sess, atMemoryErr);
return; return;
} else { } else {
@ -135,7 +136,7 @@ top:
&& sess->reply.command == sess->request.command) && sess->reply.command == sess->request.command)
{ {
if (sess->junkBuf != NULL) { if (sess->junkBuf != NULL) {
free(sess->junkBuf); DisposeHandle(FindHandle(sess->junkBuf));
sess->junkBuf = NULL; sess->junkBuf = NULL;
if (sess->reply.command == DSIOpenSession) { if (sess->reply.command == DSIOpenSession) {
// We ignore the DSIOpenSession options for now. // We ignore the DSIOpenSession options for now.