Thu, 15 May 2014 17:29:04 +0200
Backport better zephyr coverity fix from default
| libpurple/protocols/zephyr/Zinternal.c | file | annotate | diff | comparison | revisions |
--- a/libpurple/protocols/zephyr/Zinternal.c Thu May 15 15:19:58 2014 +0200 +++ b/libpurple/protocols/zephyr/Zinternal.c Thu May 15 17:29:04 2014 +0200 @@ -526,15 +526,17 @@ hole = hole->next; } if (lasthole) { - if (!(lasthole->next = (struct _Z_Hole *)(struct _Z_InputQ *) - malloc(sizeof(struct _Z_InputQ)))) + struct _Z_InputQ *inputq = malloc(sizeof(struct _Z_InputQ)); + if (!inputq) return (ENOMEM); + lasthole->next = (struct _Z_Hole *)inputq; hole = lasthole->next; } else { - if (!(qptr->holelist = (struct _Z_Hole *)(struct _Z_InputQ *) - malloc(sizeof(struct _Z_InputQ)))) + struct _Z_InputQ *inputq = malloc(sizeof(struct _Z_InputQ)); + if (!inputq) return (ENOMEM); + qptr->holelist = (struct _Z_Hole *)inputq; hole = qptr->holelist; } hole->next = NULL; @@ -550,15 +552,17 @@ hole = hole->next; } if (lasthole) { - if (!(lasthole->next = (struct _Z_Hole *)(struct _Z_InputQ *) - malloc(sizeof(struct _Z_InputQ)))) + struct _Z_InputQ *inputq = malloc(sizeof(struct _Z_InputQ)); + if (!inputq) return (ENOMEM); + lasthole->next = (struct _Z_Hole *)inputq; hole = lasthole->next; } else { - if (!(qptr->holelist = (struct _Z_Hole *)(struct _Z_InputQ *) - malloc(sizeof(struct _Z_InputQ)))) + struct _Z_InputQ *inputq = malloc(sizeof(struct _Z_InputQ)); + if (!inputq) return (ENOMEM); + qptr->holelist = (struct _Z_Hole *)inputq; hole = qptr->holelist; } hole->next = (struct _Z_Hole *) 0;