Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions library/math/math_headers.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ STATIC udouble z_notanum = {{ 0xfff80000, 0 }};
# define LOW_HALF 1
#else
# if __FLOAT_WORD_ORDER__ == __LITTLE_ENDIAN
#error Cannot use LIITLE ENDIAN on AmigaOS4
#error Cannot use LITTLE ENDIAN on AmigaOS4
# define HIGH_HALF 1
# define LOW_HALF 0
# endif
Expand All @@ -115,7 +115,7 @@ typedef union
#endif

#if __FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__
#error Cannot use LIITLE ENDIAN on AmigaOS4
#error Cannot use LITTLE ENDIAN on AmigaOS4
typedef union
{
double value;
Expand Down Expand Up @@ -149,7 +149,7 @@ typedef union
#endif

#if __FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__
#error Cannot use LIITLE ENDIAN on AmigaOS4
#error Cannot use LITTLE ENDIAN on AmigaOS4
typedef union
{
long double value;
Expand Down
3 changes: 2 additions & 1 deletion library/profile/gmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ write_bb_counts(int fd) {

void monstartup(uint32 low_pc, uint32 high_pc) {
uint8 *cp;
uint32 lowpc, highpc, text_start;
uint32 lowpc, highpc;
uint32 text_start = 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The text_start was not initialised and when if (low_pc == 0 && high_pc == 0) { was false this had no initial value at p->text_start = text_start; on line 175

struct gmonparam *p = &_gmonparam;
int o;

Expand Down
11 changes: 6 additions & 5 deletions library/shared_library/clib4.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,11 @@ extern void reent_init(struct _clib4 *__clib4, BOOL fallback);
#undef DebugPrintF
#define bug IExec->DebugPrintF
#else
# ifdef D
# undef D
# endif // D
#define D(x) ;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compiler was complaining the the D is redefined

#endif
#endif // DEBUG

int32
_start(STRPTR args, int32 arglen, struct ExecBase *sysbase) {
Expand Down Expand Up @@ -204,8 +207,6 @@ struct Clib4Library *libOpen(struct LibraryManagerInterface *Self, uint32 versio
struct Clib4Resource *res = (APTR) IExec->OpenResource(RESOURCE_NAME);
if (res) {
struct Clib4Node c2n;
char varbuf[8] = {0};
char uuid[UUID4_LEN + 1] = {0};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those were not used anywhere

uint32 pid = IDOS->GetPID(0, GPID_PROCESS);
uint32 ppid = IDOS->GetPID(0, GPID_PARENT);

Expand Down Expand Up @@ -436,11 +437,11 @@ clib4ProcessCompare(const void *a, const void *b, void *udata) {
struct Clib4Library *libInit(struct Clib4Library *libBase, BPTR seglist, struct ExecIFace *const iexec) {
libBase->libNode.lib_Node.ln_Type = NT_LIBRARY;
libBase->libNode.lib_Node.ln_Pri = LIBPRI;
libBase->libNode.lib_Node.ln_Name = LIBNAME;
libBase->libNode.lib_Node.ln_Name = (char *)LIBNAME;
libBase->libNode.lib_Flags = LIBF_SUMUSED | LIBF_CHANGED;
libBase->libNode.lib_Version = VERSION;
libBase->libNode.lib_Revision = REVISION;
libBase->libNode.lib_IdString = VSTRING;
libBase->libNode.lib_IdString = (char *)VSTRING;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compiler was complaining for losing the const character

libBase->SegList = seglist;

SysBase = (struct ExecBase *) iexec->Data.LibBase;
Expand Down
3 changes: 2 additions & 1 deletion library/socket/inet_pton.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ inet_pton(int af, const char *src, void *dst) {
static int
inet_pton4(const char *src, unsigned char *dst) {
int saw_digit, octets, ch;
unsigned char tmp[NS_INADDRSZ], *tp;
unsigned char tmp[NS_INADDRSZ] = {0};
unsigned char *tp;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tmp was not initialised and later, based on conditions, an initial value is required


saw_digit = 0;
octets = 0;
Expand Down
1 change: 1 addition & 0 deletions library/stdio/vdprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ vdprintf(int fd, const char *format, va_list ap) {
}
ret2 = vsnprintf(ptr, ret, format, ap);
if (ret2 < 0) {
free(ptr);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

memory leak

return EOF;
}
ret = ret2;
Expand Down
8 changes: 6 additions & 2 deletions library/stdlib/qsort_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,28 @@ pntz(size_t p[2]) {

static void
cycle(size_t width, unsigned char *ar[], int n) {
unsigned char tmp[256];
size_t tmp_size = 256;
unsigned char *tmp = malloc(tmp_size);
size_t l;
int i;

if (n < 2) {
free(tmp);
return;
}

ar[n] = tmp;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With these changes the following critical error is fixed, referring to this line.

Address of local auto-variable assigned to a function parameter.

while (width) {
l = sizeof(tmp) < width ? sizeof(tmp) : width;
l = tmp_size < width ? tmp_size : width;
memcpy(ar[n], ar[0], l);
for (i = 0; i < n; i++) {
memcpy(ar[i], ar[i + 1], l);
ar[i] += l;
}
width -= l;
}

free(tmp);
}

/* shl() and shr() need n > 0 */
Expand Down
1 change: 1 addition & 0 deletions library/termcap/termcap.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ tgetent(char *bp, const char *name) {
bp = (char *) malloc(malloc_size);
if (bp == NULL) {
__set_errno(ENOMEM);
free(buf.beg);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

memory leak

return -1;
}
}
Expand Down
10 changes: 5 additions & 5 deletions library/unistd/common_pathconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ __pathconf(struct MsgPort *port, int name) {
ret = 510; /* I could not find any documentation regarding this. */
break;
case _PC_MAX_INPUT: {
uint32_t Bufsize;
uint32_t Bufsize = 2048;
struct TagItem TagList[2] =
{
{DC_FHBufferR, (ULONG) & Bufsize},
{TAG_DONE, 0}
};
{
{DC_FHBufferR, (ULONG) & Bufsize},
{TAG_DONE, 0}
};
DosControl(TagList);
ret = Bufsize; /* Default is 2048 bytes. */
}
Expand Down
1 change: 1 addition & 0 deletions test_programs/network/ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ char *dns_lookup(char *addr_host, struct sockaddr_in *addr_con) {
host_entity = gethostbyname(addr_host);
if (host_entity == NULL) {
// No ip found for hostname
free(ip);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

memory leak

return NULL;
}

Expand Down
4 changes: 3 additions & 1 deletion test_programs/wchar/mblen.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ int main () {
len = mblen( pmb, MB_CUR_MAX );
printf( "Length in bytes of multibyte character %x: %u\n", pmb, len );

free(pmb);
pmb = NULL;

len = mblen( pmb, MB_CUR_MAX );
printf( "Length in bytes of multibyte character %x: %u\n", pmb, len );


free(pwcs);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

memory leaks fixes

return(0);
}
2 changes: 2 additions & 0 deletions test_programs/wchar/mbstowcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ int main() {
printf("Hex value of first wide character %#.4x\n\n", pwcs);
free(pwcs);
}

free(pmb);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

memory leak fix

return (0);
}