aboutsummaryrefslogtreecommitdiff
path: root/mkfontscale/list.c
diff options
context:
space:
mode:
Diffstat (limited to 'mkfontscale/list.c')
-rw-r--r--mkfontscale/list.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/mkfontscale/list.c b/mkfontscale/list.c
index 1614d9537..320ce20c6 100644
--- a/mkfontscale/list.c
+++ b/mkfontscale/list.c
@@ -235,7 +235,12 @@ sortList(ListPtr old)
int i;
int l = listLength(old);
ListPtr n;
- ListPtr *sorted = malloc(l * sizeof(ListPtr));
+ ListPtr *sorted;
+
+ if (l <= 0)
+ return old;
+
+ sorted = malloc(l * sizeof(ListPtr));
if (sorted == NULL)
return old;